Index: trunk/phase3/languages/Language.php |
— | — | @@ -74,6 +74,7 @@ |
75 | 75 | static public $mMergeableAliasListKeys = array( 'specialPageAliases' ); |
76 | 76 | |
77 | 77 | static public $mLocalisationCache = array(); |
| 78 | + static public $mLangObjCache = array(); |
78 | 79 | |
79 | 80 | static public $mWeekdayMsgs = array( |
80 | 81 | 'sunday', 'monday', 'tuesday', 'wednesday', 'thursday', |
— | — | @@ -130,12 +131,16 @@ |
131 | 132 | ); |
132 | 133 | |
133 | 134 | /** |
134 | | - * Create a language object for a given language code |
| 135 | + * Get a language object for a given language code |
135 | 136 | */ |
136 | 137 | static function factory( $code ) { |
137 | 138 | global $IP; |
138 | 139 | static $recursionLevel = 0; |
139 | 140 | |
| 141 | + if ( isset( self::$mLangObjCache[$code] ) ) { |
| 142 | + return self::$mLangObjCache[$code]; |
| 143 | + } |
| 144 | + |
140 | 145 | if ( $code == 'en' ) { |
141 | 146 | $class = 'Language'; |
142 | 147 | } else { |
— | — | @@ -163,6 +168,7 @@ |
164 | 169 | $lang = new $class; |
165 | 170 | } |
166 | 171 | |
| 172 | + self::$mLangObjCache[$code] = $lang; |
167 | 173 | return $lang; |
168 | 174 | } |
169 | 175 | |