Index: trunk/phase3/maintenance/rebuildLocalisationCache.php |
— | — | @@ -72,7 +72,7 @@ |
73 | 73 | } |
74 | 74 | $lc = new LocalisationCache_BulkLoad( $conf ); |
75 | 75 | |
76 | | - $codes = array_keys( Language::getLanguageNames( true ) ); |
| 76 | + $codes = array_keys( Language::fetchLanguageNames( null, 'mwfile' ) ); |
77 | 77 | sort( $codes ); |
78 | 78 | |
79 | 79 | // Initialise and split into chunks |
Index: trunk/phase3/maintenance/language/checkLanguage.inc |
— | — | @@ -402,7 +402,6 @@ |
403 | 403 | * Output the checks results as wiki text. |
404 | 404 | */ |
405 | 405 | function outputWiki() { |
406 | | - global $wgContLang; |
407 | 406 | $detailText = ''; |
408 | 407 | $rows[] = '! Language !! Code !! Total !! ' . implode( ' !! ', array_diff( $this->checks, $this->nonMessageChecks() ) ); |
409 | 408 | foreach ( $this->results as $code => $results ) { |
— | — | @@ -438,7 +437,7 @@ |
439 | 438 | # Don't list languages without problems |
440 | 439 | continue; |
441 | 440 | } |
442 | | - $language = $wgContLang->getLanguageName( $code ); |
| 441 | + $language = Language::fetchLanguageName( $code ); |
443 | 442 | $rows[] = "| $language || $code || $problems || " . implode( ' || ', $numbers ); |
444 | 443 | } |
445 | 444 | |
Index: trunk/phase3/maintenance/language/StatOutputs.php |
— | — | @@ -46,7 +46,7 @@ |
47 | 47 | /** Outputs WikiText */ |
48 | 48 | class wikiStatsOutput extends statsOutput { |
49 | 49 | function heading() { |
50 | | - global $wgDummyLanguageCodes, $wgContLang; |
| 50 | + global $wgDummyLanguageCodes; |
51 | 51 | $version = SpecialVersion::getVersion( 'nodb' ); |
52 | 52 | echo "'''Statistics are based on:''' <code>" . $version . "</code>\n\n"; |
53 | 53 | echo "'''Note:''' These statistics can be generated by running <code>php maintenance/language/transstat.php</code>.\n\n"; |
— | — | @@ -55,7 +55,7 @@ |
56 | 56 | if( is_array( $wgDummyLanguageCodes ) ) { |
57 | 57 | $dummyCodes = array(); |
58 | 58 | foreach( $wgDummyLanguageCodes as $dummyCode => $correctCode ) { |
59 | | - $dummyCodes[] = $wgContLang->getLanguageName( $dummyCode ) . ' (' . $dummyCode . ')'; |
| 59 | + $dummyCodes[] = Language::fetchLanguageName( $dummyCode ) . ' (' . $dummyCode . ')'; |
60 | 60 | } |
61 | 61 | echo ', as well as the following languages that are not intended for system message translations, usually because they redirect to other language codes: ' . implode( ', ', $dummyCodes ); |
62 | 62 | } |
Index: trunk/phase3/maintenance/language/transstat.php |
— | — | @@ -102,7 +102,7 @@ |
103 | 103 | } |
104 | 104 | |
105 | 105 | # Calculate the numbers |
106 | | - $language = $wgContLang->getLanguageName( $code ); |
| 106 | + $language = Language::fetchLanguageName( $code ); |
107 | 107 | $fallback = $wgLanguages->getFallback( $code ); |
108 | 108 | $messages = $wgLanguages->getMessages( $code ); |
109 | 109 | $messagesNumber = count( $messages['translated'] ); |
Index: trunk/phase3/maintenance/language/languages.inc |
— | — | @@ -54,7 +54,7 @@ |
55 | 55 | $this->mOptionalMessages = array_merge( $wgOptionalMessages, $wgEXIFMessages ); |
56 | 56 | } |
57 | 57 | |
58 | | - $this->mLanguages = array_keys( Language::getLanguageNames( true ) ); |
| 58 | + $this->mLanguages = array_keys( Language::fetchLanguageNames( null, 'mwfile' ) ); |
59 | 59 | sort( $this->mLanguages ); |
60 | 60 | } |
61 | 61 | |
Index: trunk/phase3/includes/GlobalFunctions.php |
— | — | @@ -1322,7 +1322,7 @@ |
1323 | 1323 | return $wgLang; |
1324 | 1324 | } |
1325 | 1325 | |
1326 | | - $validCodes = array_keys( Language::getLanguageNames() ); |
| 1326 | + $validCodes = array_keys( Language::fetchLanguageNames() ); |
1327 | 1327 | if( in_array( $langcode, $validCodes ) ) { |
1328 | 1328 | # $langcode corresponds to a valid language. |
1329 | 1329 | return Language::factory( $langcode ); |
Index: trunk/phase3/includes/installer/WebInstaller.php |
— | — | @@ -485,7 +485,7 @@ |
486 | 486 | public function getAcceptLanguage() { |
487 | 487 | global $wgLanguageCode, $wgRequest; |
488 | 488 | |
489 | | - $mwLanguages = Language::getLanguageNames(); |
| 489 | + $mwLanguages = Language::fetchLanguageNames(); |
490 | 490 | $headerLanguages = array_keys( $wgRequest->getAcceptLang() ); |
491 | 491 | |
492 | 492 | foreach ( $headerLanguages as $lang ) { |
Index: trunk/phase3/includes/installer/WebInstallerPage.php |
— | — | @@ -162,7 +162,7 @@ |
163 | 163 | $userLang = $r->getVal( 'uselang' ); |
164 | 164 | $contLang = $r->getVal( 'ContLang' ); |
165 | 165 | |
166 | | - $languages = Language::getLanguageNames(); |
| 166 | + $languages = Language::fetchLanguageNames(); |
167 | 167 | $lifetime = intval( ini_get( 'session.gc_maxlifetime' ) ); |
168 | 168 | if ( !$lifetime ) { |
169 | 169 | $lifetime = 1440; // PHP default |
— | — | @@ -233,7 +233,7 @@ |
234 | 234 | $s .= Html::openElement( 'select', array( 'id' => $name, 'name' => $name, |
235 | 235 | 'tabindex' => $this->parent->nextTabIndex() ) ) . "\n"; |
236 | 236 | |
237 | | - $languages = Language::getLanguageNames(); |
| 237 | + $languages = Language::fetchLanguageNames(); |
238 | 238 | ksort( $languages ); |
239 | 239 | foreach ( $languages as $code => $lang ) { |
240 | 240 | if ( isset( $wgDummyLanguageCodes[$code] ) ) continue; |
Index: trunk/phase3/includes/api/ApiQuerySiteinfo.php |
— | — | @@ -273,13 +273,8 @@ |
274 | 274 | |
275 | 275 | $params = $this->extractRequestParams(); |
276 | 276 | $langCode = isset( $params['inlanguagecode'] ) ? $params['inlanguagecode'] : ''; |
| 277 | + $langNames = Language::fetchLanguageNames( $langCode ); |
277 | 278 | |
278 | | - if( $langCode ) { |
279 | | - $langNames = Language::getTranslatedLanguageNames( $langCode ); |
280 | | - } else { |
281 | | - $langNames = Language::getLanguageNames(); |
282 | | - } |
283 | | - |
284 | 279 | $getPrefixes = Interwiki::getAllPrefixes( $local ); |
285 | 280 | $data = array(); |
286 | 281 | |
— | — | @@ -479,13 +474,8 @@ |
480 | 475 | public function appendLanguages( $property ) { |
481 | 476 | $params = $this->extractRequestParams(); |
482 | 477 | $langCode = isset( $params['inlanguagecode'] ) ? $params['inlanguagecode'] : ''; |
| 478 | + $langNames = Language::getLanguageNames( $langCode ); |
483 | 479 | |
484 | | - if( $langCode ) { |
485 | | - $langNames = Language::getTranslatedLanguageNames( $langCode ); |
486 | | - } else { |
487 | | - $langNames = Language::getLanguageNames(); |
488 | | - } |
489 | | - |
490 | 480 | $data = array(); |
491 | 481 | |
492 | 482 | foreach ( $langNames as $code => $name ) { |
Index: trunk/phase3/includes/api/ApiParse.php |
— | — | @@ -399,7 +399,7 @@ |
400 | 400 | $langs = array(); |
401 | 401 | foreach ( $languages as $l ) { |
402 | 402 | $nt = Title::newFromText( $l ); |
403 | | - $text = $wgContLang->getLanguageName( $nt->getInterwiki() ); |
| 403 | + $text = Language::fetchLanguageName( $nt->getInterwiki() ); |
404 | 404 | |
405 | 405 | $langs[] = Html::element( 'a', |
406 | 406 | array( 'href' => $nt->getFullURL(), 'title' => $nt->getText(), 'class' => "external" ), |
Index: trunk/phase3/includes/media/FormatMetadata.php |
— | — | @@ -800,7 +800,7 @@ |
801 | 801 | break; |
802 | 802 | |
803 | 803 | case 'LanguageCode': |
804 | | - $lang = $wgLang->getLanguageName( strtolower( $val ) ); |
| 804 | + $lang = Language::fetchLanguageName( strtolower( $val ), $wgLang ); |
805 | 805 | if ($lang) { |
806 | 806 | $val = htmlspecialchars( $lang ); |
807 | 807 | } else { |
— | — | @@ -941,7 +941,6 @@ |
942 | 942 | * this is treated as wikitext not html). |
943 | 943 | */ |
944 | 944 | private static function langItem( $value, $lang, $default = false, $noHtml = false ) { |
945 | | - global $wgContLang; |
946 | 945 | if ( $lang === false && $default === false) { |
947 | 946 | throw new MWException('$lang and $default cannot both ' |
948 | 947 | . 'be false.'); |
— | — | @@ -966,11 +965,11 @@ |
967 | 966 | } |
968 | 967 | |
969 | 968 | $lowLang = strtolower( $lang ); |
970 | | - $langName = $wgContLang->getLanguageName( $lowLang ); |
| 969 | + $langName = Language::fetchLanguageName( $lowLang ); |
971 | 970 | if ( $langName === '' ) { |
972 | 971 | //try just the base language name. (aka en-US -> en ). |
973 | 972 | list( $langPrefix ) = explode( '-', $lowLang, 2 ); |
974 | | - $langName = $wgContLang->getLanguageName( $langPrefix ); |
| 973 | + $langName = Language::fetchLanguageName( $langPrefix ); |
975 | 974 | if ( $langName === '' ) { |
976 | 975 | // give up. |
977 | 976 | $langName = $lang; |
Index: trunk/phase3/includes/cache/MessageCache.php |
— | — | @@ -497,7 +497,7 @@ |
498 | 498 | if ( $code === 'en' ) { |
499 | 499 | // Delete all sidebars, like for example on action=purge on the |
500 | 500 | // sidebar messages |
501 | | - $codes = array_keys( Language::getLanguageNames() ); |
| 501 | + $codes = array_keys( Language::fetchLanguageNames() ); |
502 | 502 | } |
503 | 503 | |
504 | 504 | global $wgMemc; |
— | — | @@ -869,7 +869,7 @@ |
870 | 870 | * Clear all stored messages. Mainly used after a mass rebuild. |
871 | 871 | */ |
872 | 872 | function clear() { |
873 | | - $langs = Language::getLanguageNames( false ); |
| 873 | + $langs = Language::fetchLanguageNames( null, 'mw' ); |
874 | 874 | foreach ( array_keys($langs) as $code ) { |
875 | 875 | # Global cache |
876 | 876 | $this->mMemc->delete( wfMemcKey( 'messages', $code ) ); |
— | — | @@ -891,8 +891,7 @@ |
892 | 892 | } |
893 | 893 | |
894 | 894 | $lang = array_pop( $pieces ); |
895 | | - $validCodes = Language::getLanguageNames(); |
896 | | - if( !array_key_exists( $lang, $validCodes ) ) { |
| 895 | + if( !Language::fetchLanguageName( $lang, null, 'mw' ) ) { |
897 | 896 | return array( $key, $wgLanguageCode ); |
898 | 897 | } |
899 | 898 | |
Index: trunk/phase3/includes/SkinLegacy.php |
— | — | @@ -348,7 +348,7 @@ |
349 | 349 | } |
350 | 350 | |
351 | 351 | function otherLanguages() { |
352 | | - global $wgOut, $wgLang, $wgContLang, $wgHideInterlanguageLinks; |
| 352 | + global $wgOut, $wgLang, $wgHideInterlanguageLinks; |
353 | 353 | |
354 | 354 | if ( $wgHideInterlanguageLinks ) { |
355 | 355 | return ''; |
— | — | @@ -375,7 +375,7 @@ |
376 | 376 | $first = false; |
377 | 377 | |
378 | 378 | $nt = Title::newFromText( $l ); |
379 | | - $text = $wgContLang->getLanguageName( $nt->getInterwiki() ); |
| 379 | + $text = Language::fetchLanguageName( $nt->getInterwiki() ); |
380 | 380 | |
381 | 381 | $s .= Html::element( 'a', |
382 | 382 | array( 'href' => $nt->getFullURL(), 'title' => $nt->getText(), 'class' => "external" ), |
Index: trunk/phase3/includes/SkinTemplate.php |
— | — | @@ -428,8 +428,8 @@ |
429 | 429 | if ( $nt ) { |
430 | 430 | $language_urls[] = array( |
431 | 431 | 'href' => $nt->getFullURL(), |
432 | | - 'text' => ( $wgContLang->getLanguageName( $nt->getInterwiki() ) != '' ? |
433 | | - $wgContLang->getLanguageName( $nt->getInterwiki() ) : $l ), |
| 432 | + 'text' => ( Language::fetchLanguageName( $nt->getInterwiki() ) != '' ? |
| 433 | + Language::fetchLanguageName( $nt->getInterwiki() ) : $l ), |
434 | 434 | 'title' => $nt->getText(), |
435 | 435 | 'class' => $class, |
436 | 436 | 'lang' => $nt->getInterwiki(), |
Index: trunk/phase3/includes/specials/SpecialAllmessages.php |
— | — | @@ -146,7 +146,7 @@ |
147 | 147 | function buildForm() { |
148 | 148 | global $wgScript; |
149 | 149 | |
150 | | - $languages = Language::getLanguageNames( false ); |
| 150 | + $languages = Language::fetchLanguageNames( null, 'mw' ); |
151 | 151 | ksort( $languages ); |
152 | 152 | |
153 | 153 | $out = Xml::openElement( 'form', array( 'method' => 'get', 'action' => $wgScript, 'id' => 'mw-allmessages-form' ) ) . |