* The language object used for lc() in Parser::braceSubstitution() must match the one used in setFunctionHook() during firstCallInit(). It can't change depending on what message you are parsing. Use $wgContLang like before r97849.
# The position of the convert() call should not be changed. it
# assumes that the links are all replaced and the only thing left
# is the <nowiki> mark.
# The position of the convert() call should not be changed. it
# assumes that the links are all replaced and the only thing left
# is the <nowiki> mark.
- $text = $this->getFunctionLang()->convert( $text );
+ $text = $this->getTargetLanguage()->convert( $text );
|| isset( $this->mDoubleUnderscores['notitleconvert'] )
|| $this->mOutput->getDisplayTitle() !== false ) )
{
|| isset( $this->mDoubleUnderscores['notitleconvert'] )
|| $this->mOutput->getDisplayTitle() !== false ) )
{
- $convruletitle = $this->getFunctionLang()->getConvRuleTitle();
+ $convruletitle = $this->getTargetLanguage()->getConvRuleTitle();
if ( $convruletitle ) {
$this->mOutput->setTitleText( $convruletitle );
} else {
if ( $convruletitle ) {
$this->mOutput->setTitleText( $convruletitle );
} else {
- $titleText = $this->getFunctionLang()->convertTitle( $title );
+ $titleText = $this->getTargetLanguage()->convertTitle( $title );
$this->mOutput->setTitleText( $titleText );
}
}
$this->mOutput->setTitleText( $titleText );
}
}
+ * Get a language object for use in parser functions such as {{FORMATNUM:}}
* @return Language
*/
function getFunctionLang() {
* @return Language
*/
function getFunctionLang() {
+ return $this->getTargetLanguage();
+ }
+
+ /**
+ * Get the target language for the content being parsed. This is usually the
+ * language that the content is in.
+ */
+ function getTargetLanguage() {
$target = $this->mOptions->getTargetLanguage();
if ( $target !== null ) {
return $target;
$target = $this->mOptions->getTargetLanguage();
if ( $target !== null ) {
return $target;
$text = $this->maybeMakeExternalImage( $url );
if ( $text === false ) {
# Not an image, make a link
$text = $this->maybeMakeExternalImage( $url );
if ( $text === false ) {
# Not an image, make a link
- $text = Linker::makeExternalLink( $url, $this->getFunctionLang()->markNoConversion($url), true, 'free',
+ $text = Linker::makeExternalLink( $url,
+ $this->getTargetLanguage()->markNoConversion($url), true, 'free',
$this->getExternalLinkAttribs( $url ) );
# Register it in the output object...
# Replace unnecessary URL escape codes with their equivalent characters
$this->getExternalLinkAttribs( $url ) );
# Register it in the output object...
# Replace unnecessary URL escape codes with their equivalent characters
# No link text, e.g. [http://domain.tld/some.link]
if ( $text == '' ) {
# Autonumber
# No link text, e.g. [http://domain.tld/some.link]
if ( $text == '' ) {
# Autonumber
- $langObj = $this->getFunctionLang();
+ $langObj = $this->getTargetLanguage();
$text = '[' . $langObj->formatNum( ++$this->mAutonumber ) . ']';
$linktype = 'autonumber';
} else {
$text = '[' . $langObj->formatNum( ++$this->mAutonumber ) . ']';
$linktype = 'autonumber';
} else {
list( $dtrail, $trail ) = Linker::splitTrail( $trail );
}
list( $dtrail, $trail ) = Linker::splitTrail( $trail );
}
- $text = $this->getFunctionLang()->markNoConversion( $text );
+ $text = $this->getTargetLanguage()->markNoConversion( $text );
$url = Sanitizer::cleanUrl( $url );
$url = Sanitizer::cleanUrl( $url );
$line = $a->current(); # Workaround for broken ArrayIterator::next() that returns "void"
$s = substr( $s, 1 );
$line = $a->current(); # Workaround for broken ArrayIterator::next() that returns "void"
$s = substr( $s, 1 );
- $useLinkPrefixExtension = $this->getFunctionLang()->linkPrefixExtension();
+ $useLinkPrefixExtension = $this->getTargetLanguage()->linkPrefixExtension();
$e2 = null;
if ( $useLinkPrefixExtension ) {
# Match the end of a line for a word that's not followed by whitespace,
$e2 = null;
if ( $useLinkPrefixExtension ) {
# Match the end of a line for a word that's not followed by whitespace,
- if ( $this->getFunctionLang()->hasVariants() ) {
- $selflink = $this->getFunctionLang()->autoConvertToAllVariants( $this->mTitle->getPrefixedText() );
+ if ( $this->getTargetLanguage()->hasVariants() ) {
+ $selflink = $this->getTargetLanguage()->autoConvertToAllVariants(
+ $this->mTitle->getPrefixedText() );
} else {
$selflink = array( $this->mTitle->getPrefixedText() );
}
} else {
$selflink = array( $this->mTitle->getPrefixedText() );
}
}
$sortkey = Sanitizer::decodeCharReferences( $sortkey );
$sortkey = str_replace( "\n", '', $sortkey );
}
$sortkey = Sanitizer::decodeCharReferences( $sortkey );
$sortkey = str_replace( "\n", '', $sortkey );
- $sortkey = $this->getFunctionLang()->convertCategoryKey( $sortkey );
+ $sortkey = $this->getTargetLanguage()->convertCategoryKey( $sortkey );
$this->mOutput->addCategory( $nt->getDBkey(), $sortkey );
/**
$this->mOutput->addCategory( $nt->getDBkey(), $sortkey );
/**
* @private
*/
function braceSubstitution( $piece, $frame ) {
* @private
*/
function braceSubstitution( $piece, $frame ) {
- global $wgNonincludableNamespaces;
+ global $wgNonincludableNamespaces, $wgContLang;
wfProfileIn( __METHOD__ );
wfProfileIn( __METHOD__.'-setup' );
wfProfileIn( __METHOD__ );
wfProfileIn( __METHOD__.'-setup' );
$function = $this->mFunctionSynonyms[1][$function];
} else {
# Case insensitive functions
$function = $this->mFunctionSynonyms[1][$function];
} else {
# Case insensitive functions
- $function = $this->getFunctionLang()->lc( $function );
+ $function = $wgContLang->lc( $function );
if ( isset( $this->mFunctionSynonyms[0][$function] ) ) {
$function = $this->mFunctionSynonyms[0][$function];
} else {
if ( isset( $this->mFunctionSynonyms[0][$function] ) ) {
$function = $this->mFunctionSynonyms[0][$function];
} else {
if ( $title ) {
$titleText = $title->getPrefixedText();
# Check for language variants if the template is not found
if ( $title ) {
$titleText = $title->getPrefixedText();
# Check for language variants if the template is not found
- if ( $this->getFunctionLang()->hasVariants() && $title->getArticleID() == 0 ) {
- $this->getFunctionLang()->findVariantLink( $part1, $title, true );
+ if ( $this->getTargetLanguage()->hasVariants() && $title->getArticleID() == 0 ) {
+ $this->getTargetLanguage()->findVariantLink( $part1, $title, true );
}
# Do recursion depth check
$limit = $this->mOptions->getMaxTemplateDepth();
}
# Do recursion depth check
$limit = $this->mOptions->getMaxTemplateDepth();
if ( $dot ) {
$numbering .= '.';
}
if ( $dot ) {
$numbering .= '.';
}
- $numbering .= $this->getFunctionLang()->formatNum( $sublevelCount[$i] );
+ $numbering .= $this->getTargetLanguage()->formatNum( $sublevelCount[$i] );