r102734 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r102733‎ | r102734 | r102735 >
Date:01:35, 11 November 2011
Author:kaldari
Status:ok
Tags:
Comment:
excluding Unknown Region from countries, adding some comments. Removing code stubs from CountryNames and CurrencyNames since these should probably inherit from an abstract class
Modified paths:
  • /trunk/extensions/cldr/CountryNames.body.php (modified) (history)
  • /trunk/extensions/cldr/CurrencyNames.body.php (modified) (history)
  • /trunk/extensions/cldr/LanguageNames.body.php (modified) (history)
  • /trunk/extensions/cldr/rebuild.php (modified) (history)

Diff [purge]

Index: trunk/extensions/cldr/CurrencyNames.body.php
@@ -9,18 +9,4 @@
1010 */
1111 class CurrencyNames {
1212 // TODO: build this class
13 -
14 - private static $cache = array();
15 -
16 - public static function getNames( $code ) {
17 - return false;
18 - }
19 -
20 - public static function getFileName( $code ) {
21 - return Language::getFileName( "CldrNames", $code, '.php' );
22 - }
23 -
24 - public static function getOverrideFileName( $code ) {
25 - return Language::getFileName( "LocalNames", $code, '.php' );
26 - }
2713 }
Index: trunk/extensions/cldr/rebuild.php
@@ -223,7 +223,7 @@
224224 if ( !isset( $attrs["DRAFT"] ) ) { // Exclude names that are draft
225225 if ( !isset( $attrs["ALT"] ) || ( isset( $attrs["ALT"] ) && $attrs["ALT"] == 'short' ) ) {
226226 preg_match( '/[A-Z][A-Z]/', $attrs['TYPE'], $matches );
227 - if ( $matches ) {
 227+ if ( $matches && $matches[0] !== 'ZZ' ) { // Exclude ZZ => Unknown Region
228228 $this->parseContents = true;
229229 $type = $matches[0];
230230 $this->output .= "'$type' => '";
Index: trunk/extensions/cldr/CountryNames.body.php
@@ -9,18 +9,4 @@
1010 */
1111 class CountryNames {
1212 // TODO: build this class
13 -
14 - private static $cache = array();
15 -
16 - public static function getNames( $code ) {
17 - return false;
18 - }
19 -
20 - public static function getFileName( $code ) {
21 - return Language::getFileName( "CldrNames", $code, '.php' );
22 - }
23 -
24 - public static function getOverrideFileName( $code ) {
25 - return Language::getFileName( "LocalNames", $code, '.php' );
26 - }
2713 }
Index: trunk/extensions/cldr/LanguageNames.body.php
@@ -17,7 +17,12 @@
1818 const LIST_MW = 1; // All names that are in Names.php
1919 const LIST_MW_AND_CLDR = 2; // Combination of Names.php and what is in cldr
2020
21 -
 21+ /**
 22+ * Get localized language names for a particular language, using fallback languages for missing
 23+ * items.
 24+ *
 25+ * @return an associative array of language codes and localized language names
 26+ */
2227 public static function getNames( $code, $fbMethod = self::FALLBACK_NATIVE, $list = self::LIST_MW ) {
2328 $xx = self::loadLanguage( $code );
2429 $native = Language::getLanguageNames( $list === self::LIST_MW_SUPPORTED );
@@ -57,8 +62,13 @@
5863
5964 }
6065
 66+ /**
 67+ * Load language names localized for a particular language.
 68+ *
 69+ * @return an associative array of language codes and localized language names
 70+ */
6171 private static function loadLanguage( $code ) {
62 - if ( !isset(self::$cache[$code]) ) {
 72+ if ( !isset( self::$cache[$code] ) ) {
6373 wfProfileIn( __METHOD__.'-recache' );
6474
6575 /* Load override for wrong or missing entries in cldr */

Status & tagging log