r79361 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r79360‎ | r79361 | r79362 >
Date:18:32, 31 December 2010
Author:nikerabbit
Status:ok
Tags:
Comment:
Use the new hook to provide translated language names
Modified paths:
  • /trunk/extensions/cldr/LanguageNames.body.php (modified) (history)
  • /trunk/extensions/cldr/cldr.php (modified) (history)

Diff [purge]

Index: trunk/extensions/cldr/LanguageNames.body.php
@@ -60,7 +60,7 @@
6161 private static function loadLanguage( $code ) {
6262 if ( !isset(self::$cache[$code]) ) {
6363
64 - /** Load override for wrong or missing entries in cldr */
 64+ /* Load override for wrong or missing entries in cldr */
6565 $override = dirname(__FILE__) . '/' . self::getOverrideFileName( $code );
6666 if ( file_exists( $override ) ) {
6767 $names = false;
@@ -97,5 +97,8 @@
9898 return Language::getFileName( "LocalNames", $code, '.php' );
9999 }
100100
101 -
 101+ public static function coreHook( &$names, $code ) {
 102+ $names += self::getNames( $code, self::FALLBACK_NORMAL, self::LIST_MW_AND_CLDR );
 103+ return true;
 104+ }
102105 }
Index: trunk/extensions/cldr/cldr.php
@@ -22,3 +22,4 @@
2323 $dir = dirname(__FILE__) . '/';
2424 $wgExtensionMessagesFiles['cldr'] = $dir . 'cldr.i18n.php';
2525 $wgAutoloadClasses['LanguageNames'] = $dir . 'LanguageNames.body.php';
 26+$wgHooks['LanguageGetTranslatedLanguageNames'][] = 'LanguageNames::coreHook';
\ No newline at end of file

Status & tagging log