Index: trunk/extensions/cldr/LanguageNames.php |
— | — | @@ -13,7 +13,7 @@ |
14 | 14 | |
15 | 15 | $wgExtensionCredits['other'][] = array( |
16 | 16 | 'name' => 'Language Names', |
17 | | - 'version' => '1.4 (CLDR 1.6.0)', |
| 17 | + 'version' => '1.5 (CLDR 1.6.0)', |
18 | 18 | 'author' => 'Niklas Laxström', |
19 | 19 | 'url' => 'http://unicode.org/cldr/repository_access.html', |
20 | 20 | 'description' => 'Extension which provides localised language names', |
Index: trunk/extensions/cldr/LanguageNames.body.php |
— | — | @@ -11,20 +11,20 @@ |
12 | 12 | |
13 | 13 | private static $cache = array(); |
14 | 14 | |
15 | | - const FALLBACK_NATIVE = 0; |
16 | | - const FALLBACK_NORMAL = 1; |
17 | | - const LIST_MW_SUPPORTED = 0; |
18 | | - const LIST_MW = 1; |
19 | | - const LIST_MW_AND_CLDR = 2; |
| 15 | + const FALLBACK_NATIVE = 0; // Missing entries fallback to native name |
| 16 | + const FALLBACK_NORMAL = 1; // Missing entries fallback trough fallback chain |
| 17 | + const LIST_MW_SUPPORTED = 0; // Only names that has localisation in MediaWiki |
| 18 | + const LIST_MW = 1; // All names that are in Names.php |
| 19 | + const LIST_MW_AND_CLDR = 2; // Combination of Names.php and what is in cldr |
20 | 20 | |
21 | 21 | |
22 | | - public static function getNames( $code, $fallback = self::FALLBACK_NATIVE, $list = self::LIST_MW ) { |
| 22 | + public static function getNames( $code, $fbMethod = self::FALLBACK_NATIVE, $list = self::LIST_MW ) { |
23 | 23 | $xx = self::loadLanguage( $code ); |
24 | 24 | $native = Language::getLanguageNames( $list === self::LIST_MW_SUPPORTED ); |
25 | 25 | |
26 | | - if ( $fallback === self::FALLBACK_NATIVE ) { |
| 26 | + if ( $fbMethod === self::FALLBACK_NATIVE ) { |
27 | 27 | $names = array_merge( $native, $xx ); |
28 | | - } elseif ( $fallback === self::FALLBACK_NORMAL ) { |
| 28 | + } elseif ( $fbMethod === self::FALLBACK_NORMAL ) { |
29 | 29 | $fallback = $code; |
30 | 30 | $fb = $xx; |
31 | 31 | while ( $fallback = Language::getFallbackFor( $fallback ) ) { |
— | — | @@ -35,10 +35,8 @@ |
36 | 36 | /* Add native names for codes that are not in cldr */ |
37 | 37 | $names = array_merge( $native, $fb ); |
38 | 38 | |
39 | | - /* Special case for native name for $code language, which is already |
40 | | - * provided by MediaWiki. |
41 | | - */ |
42 | | - if ( isset( $native[$code] ) ) { |
| 39 | + /* As a last resort, try the native name in Names.php */ |
| 40 | + if ( !isset( $names[$code] ) && isset( $native[$code] ) ) { |
43 | 41 | $names[$code] = $native[$code]; |
44 | 42 | } |
45 | 43 | } else { |