r86350 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r86349‎ | r86350 | r86351 >
Date:21:58, 18 April 2011
Author:kaldari
Status:ok (Comments)
Tags:
Comment:
partial fix for Bug 9465
Modified paths:
  • /trunk/extensions/I18nTags/I18nTags_body.php (modified) (history)

Diff [purge]

Index: trunk/extensions/I18nTags/I18nTags_body.php
@@ -52,14 +52,17 @@
5353 return "<b>$predata$inside</b>$data";
5454 }
5555
56 - public static function languageName( &$parser, $code = '', $native = '' ) {
 56+ public static function languageName( &$parser, $code = '', $outputLanguage = '' ) {
5757 global $wgLang;
5858 if ( !$code ) {
5959 return '';
6060 }
 61+ if ( !$outputLanguage ) {
 62+ $outputLanguage = $wgLang->getCode();
 63+ }
6164 $cldr = is_callable( array( 'LanguageNames', 'getNames' ));
62 - if ( $native !== 'native' && $cldr ) {
63 - $languages = LanguageNames::getNames( $wgLang->getCode(),
 65+ if ( $outputLanguage !== 'native' && $cldr ) {
 66+ $languages = LanguageNames::getNames( $outputLanguage,
6467 LanguageNames::FALLBACK_NORMAL,
6568 LanguageNames::LIST_MW_AND_CLDR
6669 );

Comments

#Comment by Kaldari (talk | contribs)   22:28, 18 April 2011

Now the function can accept other values besides 'native' for the 3rd parameter - specifically language codes. If a language code is passed as the third parameter, that will become the output language, i.e. the language of the language string returned. This change should be completely backwards compatible as the 'native' value is still accepted and used appropriately.

Status & tagging log