diff options
Diffstat (limited to 'MLEB/cldr/includes/CountryNames.php')
-rw-r--r-- | MLEB/cldr/includes/CountryNames.php | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/MLEB/cldr/includes/CountryNames.php b/MLEB/cldr/includes/CountryNames.php index 5e13d90b..65954f0f 100644 --- a/MLEB/cldr/includes/CountryNames.php +++ b/MLEB/cldr/includes/CountryNames.php @@ -1,5 +1,7 @@ <?php +use MediaWiki\MediaWikiServices; + /** * A class for querying translated country names from CLDR data. * @@ -24,7 +26,7 @@ class CountryNames extends CldrNames { $names = self::loadLanguage( $code ); // Load missing country names from fallback languages - $fallbacks = Language::getFallbacksFor( $code ); + $fallbacks = MediaWikiServices::getInstance()->getLanguageFallback()->getAll( $code ); foreach ( $fallbacks as $fallback ) { // Overwrite the things in fallback with what we have already $names = array_merge( self::loadLanguage( $fallback ), $names ); @@ -41,9 +43,12 @@ class CountryNames extends CldrNames { */ private static function loadLanguage( $code ) { if ( !isset( self::$cache[$code] ) ) { + + $langNameUtils = MediaWikiServices::getInstance()->getLanguageNameUtils(); + /* Load override for wrong or missing entries in cldr */ $override = __DIR__ . '/../LocalNames/' . self::getOverrideFileName( $code ); - if ( Language::isValidBuiltInCode( $code ) && file_exists( $override ) ) { + if ( $langNameUtils->isValidBuiltInCode( $code ) && file_exists( $override ) ) { $countryNames = false; require $override; // @phan-suppress-next-line PhanImpossibleCondition @@ -53,14 +58,14 @@ class CountryNames extends CldrNames { } $filename = __DIR__ . '/../CldrNames/' . self::getFileName( $code ); - if ( Language::isValidBuiltInCode( $code ) && file_exists( $filename ) ) { + if ( $langNameUtils->isValidBuiltInCode( $code ) && file_exists( $filename ) ) { $countryNames = false; require $filename; // @phan-suppress-next-line PhanImpossibleCondition if ( is_array( $countryNames ) ) { if ( isset( self::$cache[$code] ) ) { // Add to existing list of localized country names - self::$cache[$code] = self::$cache[$code] + $countryNames; + self::$cache[$code] += $countryNames; } else { // No list exists, so create it self::$cache[$code] = $countryNames; |