The getConverterLanguage() method was added in March 2012 in commit
561424c266128a8c2c213cd803d4786313fc20cc as a workaround for a regression
in mediawiki 1.19. It was an indirection which checked the global variable
$wgBug34832TransitionalRollback to return a different converter language
for Chinese wikis.
When this temporary bugfix was reverted in January 2013 in commit
a3fbdaaa2c4eb5ddc6bfbd62ae57a7804a307f12, the temporary global variable
was removed, but not the getConverterLanguage() indirection. Since then,
new code in the parser seems to have faithfully used getConverterLanguage()
instead of getTargetLanguage(), even though they are identical and the
need for getConverterLanguage() has long since passed.
Strike a small blow for elegant minimalism by removing the completely
unnecessary Parser::getConverterLanguage() indirection. Well, sort
of: since this blight has been slowly growing inside Parser.php for
so long, we need to deprecate getConverterLanguage() first just in
case any external dependency has been infected. Next release we
can finally excise the unnecessary method.
Change-Id: I567c29c9c7699020955699b76cbe8578d02e2fe6
* Class CryptRand, everything in MWCryptRand except generateHex() and function
MediaWikiServices::getCryptRand() are deprecated, use random_bytes() to
generate cryptographically secure random byte sequences.
* Class CryptRand, everything in MWCryptRand except generateHex() and function
MediaWikiServices::getCryptRand() are deprecated, use random_bytes() to
generate cryptographically secure random byte sequences.
+* Parser::getConverterLanguage() is deprecated. Use ::getTargetLanguage()
+ instead.
=== Other changes in 1.32 ===
* …
=== Other changes in 1.32 ===
* …
$parser->mOutput->setDisplayTitle( $text );
}
if ( $old !== false && $old !== $text && !$arg ) {
$parser->mOutput->setDisplayTitle( $text );
}
if ( $old !== false && $old !== $text && !$arg ) {
- $converter = $parser->getConverterLanguage()->getConverter();
+ $converter = $parser->getTargetLanguage()->getConverter();
return '<span class="error">' .
wfMessage( 'duplicate-displaytitle',
// Message should be parsed, but these params should only be escaped.
return '<span class="error">' .
wfMessage( 'duplicate-displaytitle',
// Message should be parsed, but these params should only be escaped.
- $converter = $parser->getConverterLanguage()->getConverter();
+ $converter = $parser->getTargetLanguage()->getConverter();
$parser->getOutput()->addWarning(
wfMessage( 'restricted-displaytitle',
// Message should be parsed, but this param should only be escaped.
$parser->getOutput()->addWarning(
wfMessage( 'restricted-displaytitle',
// Message should be parsed, but this param should only be escaped.
if ( $old === false || $old == $text || $arg ) {
return '';
} else {
if ( $old === false || $old == $text || $arg ) {
return '';
} else {
- $converter = $parser->getConverterLanguage()->getConverter();
+ $converter = $parser->getTargetLanguage()->getConverter();
return '<span class="error">' .
wfMessage( 'duplicate-defaultsort',
// Message should be parsed, but these params should only be escaped.
return '<span class="error">' .
wfMessage( 'duplicate-defaultsort',
// Message should be parsed, but these params should only be escaped.
|| isset( $this->mDoubleUnderscores['notitleconvert'] )
|| $this->mOutput->getDisplayTitle() !== false )
) {
|| isset( $this->mDoubleUnderscores['notitleconvert'] )
|| $this->mOutput->getDisplayTitle() !== false )
) {
- $convruletitle = $this->getConverterLanguage()->getConvRuleTitle();
+ $convruletitle = $this->getTargetLanguage()->getConvRuleTitle();
if ( $convruletitle ) {
$this->mOutput->setTitleText( $convruletitle );
} else {
if ( $convruletitle ) {
$this->mOutput->setTitleText( $convruletitle );
} else {
- $titleText = $this->getConverterLanguage()->convertTitle( $title );
+ $titleText = $this->getTargetLanguage()->convertTitle( $title );
$this->mOutput->setTitleText( $titleText );
}
}
$this->mOutput->setTitleText( $titleText );
}
}
/**
* Get the language object for language conversion
/**
* Get the language object for language conversion
+ * @deprecated since 1.32, just use getTargetLanguage()
* @return Language|null
*/
public function getConverterLanguage() {
* @return Language|null
*/
public function getConverterLanguage() {
# 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->getConverterLanguage()->convert( $text );
+ $text = $this->getTargetLanguage()->convert( $text );
if ( $text === false ) {
# Not an image, make a link
$text = Linker::makeExternalLink( $url,
if ( $text === false ) {
# Not an image, make a link
$text = Linker::makeExternalLink( $url,
- $this->getConverterLanguage()->markNoConversion( $url, true ),
+ $this->getTargetLanguage()->markNoConversion( $url, true ),
true, 'free',
$this->getExternalLinkAttribs( $url ), $this->mTitle );
# Register it in the output object...
true, 'free',
$this->getExternalLinkAttribs( $url ), $this->mTitle );
# Register it in the output object...
list( $dtrail, $trail ) = Linker::splitTrail( $trail );
}
list( $dtrail, $trail ) = Linker::splitTrail( $trail );
}
- $text = $this->getConverterLanguage()->markNoConversion( $text );
+ $text = $this->getTargetLanguage()->markNoConversion( $text );
$url = Sanitizer::cleanUrl( $url );
$url = Sanitizer::cleanUrl( $url );
}
$sortkey = Sanitizer::decodeCharReferences( $sortkey );
$sortkey = str_replace( "\n", '', $sortkey );
}
$sortkey = Sanitizer::decodeCharReferences( $sortkey );
$sortkey = str_replace( "\n", '', $sortkey );
- $sortkey = $this->getConverterLanguage()->convertCategoryKey( $sortkey );
+ $sortkey = $this->getTargetLanguage()->convertCategoryKey( $sortkey );
$this->mOutput->addCategory( $nt->getDBkey(), $sortkey );
continue;
$this->mOutput->addCategory( $nt->getDBkey(), $sortkey );
continue;
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->getConverterLanguage()->hasVariants() && $title->getArticleID() == 0 ) {
- $this->getConverterLanguage()->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();