context[$varName] = $value; } function translate( $value ) { wfProfileIn( __METHOD__ ); // Hack for i18n:attributes in PHPTAL 1.0.0 dev version as of 2004-10-23 $value = preg_replace( '/^string:/', '', $value ); $value = wfMessage( $value )->text(); // interpolate variables $m = array(); while ( preg_match( '/\$([0-9]*?)/sm', $value, $m ) ) { list( $src, $var ) = $m; wfSuppressWarnings(); $varValue = $this->context[$var]; wfRestoreWarnings(); $value = str_replace( $src, $varValue, $value ); } wfProfileOut( __METHOD__ ); return $value; } }