Index: trunk/phase3/languages/Language.php |
— | — | @@ -55,6 +55,7 @@ |
56 | 56 | class Language { |
57 | 57 | var $mConverter, $mVariants, $mCode, $mLoaded = false; |
58 | 58 | var $mMagicExtensions = array(), $mMagicHookDone = false; |
| 59 | + var $mLocalizedLanguagesNames = null; |
59 | 60 | |
60 | 61 | static public $mLocalisationKeys = array( |
61 | 62 | 'fallback', 'namespaceNames', 'mathNames', 'bookstoreList', |
— | — | @@ -410,6 +411,19 @@ |
411 | 412 | } |
412 | 413 | |
413 | 414 | /** |
| 415 | + * Get localized language names |
| 416 | + * |
| 417 | + * @return array |
| 418 | + */ |
| 419 | + function getLocalizedLanguageNames() { |
| 420 | + if( !is_array( $this->mLocalizedLanguagesNames ) ) { |
| 421 | + $this->mLocalizedLanguagesNames = array(); |
| 422 | + wfRunHooks( 'LanguageGetLocalizedLanguageNames', array( &$this->mLocalizedLanguagesNames, $this->getCode() ) ); |
| 423 | + } |
| 424 | + return $this->mLocalizedLanguagesNames; |
| 425 | + } |
| 426 | + |
| 427 | + /** |
414 | 428 | * Get a message from the MediaWiki namespace. |
415 | 429 | * |
416 | 430 | * @param $msg String: message name |
— | — | @@ -431,8 +445,7 @@ |
432 | 446 | return ''; |
433 | 447 | } |
434 | 448 | if( $localized ) { |
435 | | - $languageNames = array(); |
436 | | - wfRunHooks( 'LanguageGetLocalizedLanguageNames', array( &$languageNames, $this->getCode() ) ); |
| 449 | + $languageNames = $this->getLocalizedLanguageNames(); |
437 | 450 | return isset( $languageNames[$code] ) ? $languageNames[$code] : $names[$code]; |
438 | 451 | } else { |
439 | 452 | return $names[$code]; |