Merge "Add 3D filetype for STL files"
[lhc/web/wiklou.git] / languages / LanguageConverter.php
index 6286a2b..19d644c 100644 (file)
@@ -36,6 +36,7 @@ class LanguageConverter {
         * @var array
         */
        static public $languagesWithVariants = [
+               'en',
                'gan',
                'iu',
                'kk',
@@ -48,6 +49,10 @@ class LanguageConverter {
        ];
 
        public $mMainLanguageCode;
+
+       /**
+        * @var string[]
+        */
        public $mVariants;
        public $mVariantFallbacks;
        public $mVariantNames;
@@ -56,11 +61,6 @@ class LanguageConverter {
        // 'bidirectional' 'unidirectional' 'disable' for each variant
        public $mManualLevel;
 
-       /**
-        * @var string Memcached key name
-        */
-       public $mCacheKey;
-
        public $mLangObj;
        public $mFlags;
        public $mDescCodeSep = ':', $mDescVarSep = ';';
@@ -75,11 +75,9 @@ class LanguageConverter {
        const CACHE_VERSION_KEY = 'VERSION 7';
 
        /**
-        * Constructor
-        *
         * @param Language $langobj
         * @param string $maincode The main language code of this language
-        * @param array $variants The supported variants of this language
+        * @param string[] $variants The supported variants of this language
         * @param array $variantfallbacks The fallback language of each variant
         * @param array $flags Defining the custom strings that maps to the flags
         * @param array $manualLevel Limit for supported variants
@@ -93,7 +91,6 @@ class LanguageConverter {
                $this->mVariants = array_diff( $variants, $wgDisabledVariants );
                $this->mVariantFallbacks = $variantfallbacks;
                $this->mVariantNames = Language::fetchLanguageNames();
-               $this->mCacheKey = wfMemcKey( 'conversiontables', $maincode );
                $defaultflags = [
                        // 'S' show converted text
                        // '+' add rules for alltext
@@ -122,7 +119,7 @@ class LanguageConverter {
         * Get all valid variants.
         * Call this instead of using $this->mVariants directly.
         *
-        * @return array Contains all valid variants
+        * @return string[] Contains all valid variants
         */
        public function getVariants() {
                return $this->mVariants;
@@ -864,8 +861,9 @@ class LanguageConverter {
                $this->mTablesLoaded = true;
                $this->mTables = false;
                $cache = ObjectCache::getInstance( $wgLanguageConverterCacheType );
+               $cacheKey = $cache->makeKey( 'conversiontables', $this->mMainLanguageCode );
                if ( $fromCache ) {
-                       $this->mTables = $cache->get( $this->mCacheKey );
+                       $this->mTables = $cache->get( $cacheKey );
                }
                if ( !$this->mTables || !array_key_exists( self::CACHE_VERSION_KEY, $this->mTables ) ) {
                        // not in cache, or we need a fresh reload.
@@ -880,7 +878,7 @@ class LanguageConverter {
                        $this->postLoadTables();
                        $this->mTables[self::CACHE_VERSION_KEY] = true;
 
-                       $cache->set( $this->mCacheKey, $this->mTables, 43200 );
+                       $cache->set( $cacheKey, $this->mTables, 43200 );
                }
        }