diff options
Diffstat (limited to 'MLEB/cldr/includes/TimeUnits.php')
-rw-r--r-- | MLEB/cldr/includes/TimeUnits.php | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/MLEB/cldr/includes/TimeUnits.php b/MLEB/cldr/includes/TimeUnits.php index 731e0d46..dbebc209 100644 --- a/MLEB/cldr/includes/TimeUnits.php +++ b/MLEB/cldr/includes/TimeUnits.php @@ -1,5 +1,7 @@ <?php +use MediaWiki\MediaWikiServices; + /** * A class for querying translated time units from CLDR data. * @@ -51,9 +53,11 @@ class TimeUnits extends CldrNames { if ( !isset( self::$cache[$code] ) ) { self::$cache[$code] = []; + $langNameUtil = 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 ( $langNameUtil->isValidBuiltInCode( $code ) && file_exists( $override ) ) { $timeUnits = false; require $override; @@ -65,12 +69,12 @@ class TimeUnits extends CldrNames { } $filename = __DIR__ . '/../CldrNames/' . self::getFileName( $code ); - if ( Language::isValidBuiltInCode( $code ) && file_exists( $filename ) ) { + if ( $langNameUtil->isValidBuiltInCode( $code ) && file_exists( $filename ) ) { $timeUnits = false; require $filename; // @phan-suppress-next-line PhanImpossibleCondition if ( is_array( $timeUnits ) ) { - self::$cache[$code] = self::$cache[$code] + $timeUnits; + self::$cache[$code] += $timeUnits; } } else { wfDebug( __METHOD__ . ": Unable to load time units for $filename\n" ); |