MediaWiki r90900 - Code Review

Jump to: navigation, search
Repository:MediaWiki
Revision:r90899‎ | r90900 (on ViewVC)‎ | r90901 >
Date:19:26, 27 June 2011
Author:kaldari
Status:ok
Tags:
Comment:
adding support for CLDR language lists
Modified paths:

Diff [purge]

Index: trunk/extensions/CentralNotice/SpecialCentralNotice.php
@@ -1519,9 +1519,19 @@
15201520 function languageMultiSelector( $selected = array(), $customisedOnly = true ) {
15211521 global $wgLanguageCode, $wgExtensionAssetsPath, $wgLang;
15221522 $scriptPath = "$wgExtensionAssetsPath/CentralNotice";
 1523+ if ( is_callable( array( 'LanguageNames', 'getNames' ) ) ) {
 1524+ // Retrieve the list of languages in user's language (via CLDR)
 1525+ $languages = LanguageNames::getNames(
 1526+ $wgLang->getCode(), // User's language
 1527+ LanguageNames::FALLBACK_NORMAL, // Use fallback chain
 1528+ LanguageNames::LIST_MW // Pull all languages that are in Names.php
 1529+ );
 1530+ } else {
 1531+ // Use this as fallback if CLDR extension is not enabled
 1532+ $languages = Language::getLanguageNames();
 1533+ }
15231534 // Make sure the site language is in the list; a custom language code
15241535 // might not have a defined name...
1525 - $languages = Language::getLanguageNames();
15261536 if( !array_key_exists( $wgLanguageCode, $languages ) ) {
15271537 $languages[$wgLanguageCode] = $wgLanguageCode;
15281538 }

Status & tagging log

  • 23:02, 27 June 2011 Reedy (talk | contribs) changed the status of r90900 [removed: new added: ok]