MediaWiki r28212 - Code Review

Jump to: navigation, search
Repository:MediaWiki
Revision:r28211‎ | r28212 (on ViewVC)‎ | r28213 >
Date:16:49, 6 December 2007
Author:nikerabbit
Status:old
Tags:
Comment:
* New configuration variable $wgExtraLanguageNames
Modified paths:

Diff [purge]

Index: trunk/phase3/includes/DefaultSettings.php
@@ -729,6 +729,8 @@
730730 /** Hide interlanguage links from the sidebar */
731731 $wgHideInterlanguageLinks = false;
732732
 733+/** List of language names or overrides for default names in Names.php */
 734+$wgExtraLanguageNames = array();
733735
734736 /** We speak UTF-8 all the time now, unless some oddities happen */
735737 $wgInputEncoding = 'UTF-8';
Index: trunk/phase3/languages/Language.php
@@ -349,9 +349,10 @@
350350 * If $customisedOnly is true, only returns codes with a messages file
351351 */
352352 public static function getLanguageNames( $customisedOnly = false ) {
353 - global $wgLanguageNames;
 353+ global $wgLanguageNames, $wgExtraLanguageNames;
 354+ $allNames = $wgExtraLanguageNames + $wgLanguageNames;
354355 if ( !$customisedOnly ) {
355 - return $wgLanguageNames;
 356+ return $allNames;
356357 }
357358
358359 global $IP;
@@ -361,8 +362,8 @@
362363 $m = array();
363364 if( preg_match( '/Messages([A-Z][a-z_]+)\.php$/', $file, $m ) ) {
364365 $code = str_replace( '_', '-', strtolower( $m[1] ) );
365 - if ( isset( $wgLanguageNames[$code] ) ) {
366 - $names[$code] = $wgLanguageNames[$code];
 366+ if ( isset( $allNames[$code] ) ) {
 367+ $names[$code] = $allNames[$code];
367368 }
368369 }
369370 }
@@ -389,11 +390,11 @@
390391 }
391392
392393 function getLanguageName( $code ) {
393 - global $wgLanguageNames;
394 - if ( ! array_key_exists( $code, $wgLanguageNames ) ) {
 394+ $names = self::getLanguageNames();
 395+ if ( !array_key_exists( $code, $names ) ) {
395396 return '';
396397 }
397 - return $wgLanguageNames[$code];
 398+ return $names[$code];
398399 }
399400
400401 function getMonthName( $key ) {
Index: trunk/phase3/RELEASE-NOTES
@@ -90,6 +90,7 @@
9191 * (bug 8396) Ignore out-of-date serialised message caches
9292 * (bug 12195) Undeleting pages now requires 'undelete' permission
9393 * (bug 11810) Localize displayed semicolons
 94+* New configuration variable $wgExtraLanguageNames
9495
9596 === Bug fixes in 1.12 ===
9697

Status & tagging log

  • 15:23, 12 September 2011 Meno25 (talk | contribs) changed the status of r28212 [removed: ok added: old]