* New configuration variable $wgExtraLanguageNames
authorNiklas Laxström <nikerabbit@users.mediawiki.org>
Thu, 6 Dec 2007 16:49:48 +0000 (16:49 +0000)
committerNiklas Laxström <nikerabbit@users.mediawiki.org>
Thu, 6 Dec 2007 16:49:48 +0000 (16:49 +0000)
RELEASE-NOTES
includes/DefaultSettings.php
languages/Language.php

index f9cb3f1..bd51008 100644 (file)
@@ -90,6 +90,7 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN
 * (bug 8396) Ignore out-of-date serialised message caches
 * (bug 12195) Undeleting pages now requires 'undelete' permission
 * (bug 11810) Localize displayed semicolons
+* New configuration variable $wgExtraLanguageNames
 
 === Bug fixes in 1.12 ===
 
index cad2e50..3cb4235 100644 (file)
@@ -729,6 +729,8 @@ $wgInterwikiMagic = true;
 /** Hide interlanguage links from the sidebar */
 $wgHideInterlanguageLinks = false;
 
+/** List of language names or overrides for default names in Names.php */
+$wgExtraLanguageNames = array();
 
 /** We speak UTF-8 all the time now, unless some oddities happen */
 $wgInputEncoding  = 'UTF-8';
index 79d76f7..a6e8e9f 100644 (file)
@@ -349,9 +349,10 @@ class Language {
         * If $customisedOnly is true, only returns codes with a messages file
         */
        public static function getLanguageNames( $customisedOnly = false ) {
-               global $wgLanguageNames;
+               global $wgLanguageNames, $wgExtraLanguageNames;
+               $allNames = $wgExtraLanguageNames + $wgLanguageNames;
                if ( !$customisedOnly ) {
-                       return $wgLanguageNames;
+                       return $allNames;
                }
                
                global $IP;
@@ -361,8 +362,8 @@ class Language {
                        $m = array();
                        if( preg_match( '/Messages([A-Z][a-z_]+)\.php$/', $file, $m ) ) {
                                $code = str_replace( '_', '-', strtolower( $m[1] ) );
-                               if ( isset( $wgLanguageNames[$code] ) ) {
-                                       $names[$code] = $wgLanguageNames[$code];
+                               if ( isset( $allNames[$code] ) ) {
+                                       $names[$code] = $allNames[$code];
                                }
                        }
                }
@@ -389,11 +390,11 @@ class Language {
        }
 
        function getLanguageName( $code ) {
-               global $wgLanguageNames;
-               if ( ! array_key_exists( $code, $wgLanguageNames ) ) {
+               $names = self::getLanguageNames();
+               if ( !array_key_exists( $code, $names ) ) {
                        return '';
                }
-               return $wgLanguageNames[$code];
+               return $names[$code];
        }
 
        function getMonthName( $key ) {