# 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 ) )
{
- $convruletitle = $this->getFunctionLang()->getConvRuleTitle();
+ $convruletitle = $this->getTargetLanguage()->getConvRuleTitle();
if ( $convruletitle ) {
$this->mOutput->setTitleText( $convruletitle );
} else {
- $titleText = $this->getFunctionLang()->convertTitle( $title );
+ $titleText = $this->getTargetLanguage()->convertTitle( $title );
$this->mOutput->setTitleText( $titleText );
}
}
}
/**
+ * Get a language object for use in parser functions such as {{FORMATNUM:}}
* @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;
$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
# 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 {
list( $dtrail, $trail ) = Linker::splitTrail( $trail );
}
- $text = $this->getFunctionLang()->markNoConversion( $text );
+ $text = $this->getTargetLanguage()->markNoConversion( $text );
$url = Sanitizer::cleanUrl( $url );
$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,
$prefix = '';
}
- 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() );
}
}
$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 );
/**
* @private
*/
function braceSubstitution( $piece, $frame ) {
- global $wgNonincludableNamespaces;
+ global $wgNonincludableNamespaces, $wgContLang;
wfProfileIn( __METHOD__ );
wfProfileIn( __METHOD__.'-setup' );
$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 ( $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();
if ( $dot ) {
$numbering .= '.';
}
- $numbering .= $this->getFunctionLang()->formatNum( $sublevelCount[$i] );
+ $numbering .= $this->getTargetLanguage()->formatNum( $sublevelCount[$i] );
$dot = 1;
}
}