Index: trunk/phase3/includes/GlobalFunctions.php |
— | — | @@ -414,19 +414,21 @@ |
415 | 415 | return wfMsgReal( $key, $args, false, true ); |
416 | 416 | } |
417 | 417 | |
| 418 | + |
418 | 419 | /** |
419 | 420 | * Really get a message |
420 | 421 | */ |
421 | 422 | function wfMsgReal( $key, $args, $useDB, $forContent=false ) { |
422 | | - global $wgReplacementKeys; |
| 423 | + global $wgReplacementKeys, $wgParser, $wgMsgParserOptions; |
| 424 | + |
423 | 425 | if($forContent) { |
424 | | - global $wgContMessageCache, $wgContLang; |
425 | | - $cache = &$wgContMessageCache; |
| 426 | + global $wgMessageCache, $wgContLang; |
| 427 | + $cache = &$wgMessageCache; |
426 | 428 | $lang = &$wgContLang; |
427 | 429 | } |
428 | 430 | else { |
429 | | - global $wgMessageCache, $wgLang; |
430 | | - $cache = &$wgMessageCache; |
| 431 | + global $wgLang; |
| 432 | + $cache = false; |
431 | 433 | $lang = &$wgLang; |
432 | 434 | } |
433 | 435 | |
— | — | @@ -436,6 +438,9 @@ |
437 | 439 | $message = $cache->get( $key, $useDB ); |
438 | 440 | } elseif (is_object($lang)) { |
439 | 441 | $message = $lang->getMessage( $key ); |
| 442 | + if(strstr($message, '{{' ) !== false) { |
| 443 | + $message = $wgParser->transformMsg($message, $wgMsgParserOptions); |
| 444 | + } |
440 | 445 | } else { |
441 | 446 | wfDebug( "No language object when getting $key\n" ); |
442 | 447 | $message = "<$key>"; |
Index: trunk/phase3/includes/MessageCache.php |
— | — | @@ -23,12 +23,11 @@ |
24 | 24 | var $mMemcKey, $mKeys, $mParserOptions, $mParser; |
25 | 25 | var $mExtensionMessages; |
26 | 26 | var $mInitialised = false; |
27 | | - var $mLang, $mLangCode; |
28 | | - function initialise( &$memCached, $useDB, $expiry, $memcPrefix, $langobj, $langcode) { |
| 27 | + |
| 28 | + function initialise( &$memCached, $useDB, $expiry, $memcPrefix) { |
29 | 29 | $fname = 'MessageCache::initialise'; |
30 | 30 | wfProfileIn( $fname ); |
31 | | - $this->mLang = $langobj; |
32 | | - $this->mLangCode = $langcode; |
| 31 | + |
33 | 32 | $this->mUseCache = !is_null( $memCached ); |
34 | 33 | $this->mMemc = &$memCached; |
35 | 34 | $this->mDisable = !$useDB; |
— | — | @@ -141,11 +140,11 @@ |
142 | 141 | * Not really needed anymore |
143 | 142 | */ |
144 | 143 | function getKeys() { |
145 | | - global $wgAllMessagesEn; |
| 144 | + global $wgAllMessagesEn, $wgContLang; |
146 | 145 | if ( !$this->mKeys ) { |
147 | 146 | $this->mKeys = array(); |
148 | 147 | foreach ( $wgAllMessagesEn as $key => $value ) { |
149 | | - array_push( $this->mKeys, $this->mLang->ucfirst( $key ) ); |
| 148 | + array_push( $this->mKeys, $wgContLang->ucfirst( $key ) ); |
150 | 149 | } |
151 | 150 | } |
152 | 151 | return $this->mKeys; |
— | — | @@ -200,7 +199,7 @@ |
201 | 200 | } |
202 | 201 | |
203 | 202 | function get( $key, $useDB ) { |
204 | | - |
| 203 | + global $wgContLang, $wgContLanguageCode; |
205 | 204 | # If uninitialised, someone is trying to call this halfway through Setup.php |
206 | 205 | if ( !$this->mInitialised ) { |
207 | 206 | return "<$key>"; |
— | — | @@ -208,7 +207,7 @@ |
209 | 208 | |
210 | 209 | $message = false; |
211 | 210 | if ( !$this->mDisable && $useDB ) { |
212 | | - $title = $this->mLang->ucfirst( $key ); |
| 211 | + $title = $wgContLang->ucfirst( $key ); |
213 | 212 | |
214 | 213 | |
215 | 214 | # Try the cache |
— | — | @@ -235,12 +234,12 @@ |
236 | 235 | # Try the array in the language object |
237 | 236 | if ( !$message ) { |
238 | 237 | wfSuppressWarnings(); |
239 | | - $message = $this->mLang->getMessage( $key ); |
| 238 | + $message = $wgContLang->getMessage( $key ); |
240 | 239 | wfRestoreWarnings(); |
241 | 240 | } |
242 | 241 | |
243 | 242 | # Try the English array |
244 | | - if ( !$message && $this->mLangCode != 'en' ) { |
| 243 | + if ( !$message && $wgContLanguageCode != 'en' ) { |
245 | 244 | wfSuppressWarnings(); |
246 | 245 | $message = Language::getMessage( $key ); |
247 | 246 | wfRestoreWarnings(); |
Index: trunk/phase3/includes/Setup.php |
— | — | @@ -80,9 +80,9 @@ |
81 | 81 | global $wgUser, $wgLang, $wgContLang, $wgOut, $wgTitle; |
82 | 82 | global $wgArticle, $wgDeferredUpdateList, $wgLinkCache; |
83 | 83 | global $wgMemc, $wgMagicWords, $wgMwRedir, $wgDebugLogFile; |
84 | | -global $wgMessageCache, $wgUseMemCached, $wgUseDatabaseMessages, $wgContMessageCach; |
| 84 | +global $wgMessageCache, $wgUseMemCached, $wgUseDatabaseMessages; |
85 | 85 | global $wgMsgCacheExpiry, $wgCommandLineMode; |
86 | | -global $wgBlockCache, $wgParserCache, $wgParser, $wgDBConnections; |
| 86 | +global $wgBlockCache, $wgParserCache, $wgParser, $wgDBConnections, $wgMsgParserOptions; |
87 | 87 | global $wgLoadBalancer, $wgDBservers, $wgDebugDumpSql; |
88 | 88 | global $wgDBserver, $wgDBuser, $wgDBpassword, $wgDBname, $wgDBtype; |
89 | 89 | global $wgUseOldExistenceCheck, $wgEnablePersistentLC; |
— | — | @@ -261,7 +261,8 @@ |
262 | 262 | $wgLanguageCode = $wgUser->getOption('language'); |
263 | 263 | |
264 | 264 | $wgLangClass = 'Language'. str_replace( '-', '_', ucfirst( $wgLanguageCode ) ); |
265 | | -if($wgLangClass == $wgContLangClass) { |
| 265 | + |
| 266 | +if($wgLangClass == $wgContLangClass ) { |
266 | 267 | $wgLang = &$wgContLang; |
267 | 268 | } |
268 | 269 | else { |
— | — | @@ -273,15 +274,8 @@ |
274 | 275 | wfProfileOut( $fname.'-language' ); |
275 | 276 | wfProfileIn( $fname.'-MessageCache' ); |
276 | 277 | |
277 | | -$wgContMessageCache = new MessageCache; |
278 | | -$wgContMessageCache->initialise( $messageMemc, $wgUseDatabaseMessages, $wgMsgCacheExpiry, $wgDBname, $wgContLang, $wgContLanguageCode ); |
279 | | -if($wgLangClass == $wgContLangClass) { |
280 | | - $wgMessageCache = &$wgContMessageCache; |
281 | | -} |
282 | | -else { |
283 | | - $wgMessageCache = new MessageCache; |
284 | | - $wgMessageCache->initialise( $messageMemc,false , $wgMsgCacheExpiry, $wgDBname.":$wgLangClass", $wgLang, $wgLanguageCode); |
285 | | -} |
| 278 | +$wgMessageCache = new MessageCache; |
| 279 | +$wgMessageCache->initialise( $messageMemc, $wgUseDatabaseMessages, $wgMsgCacheExpiry, $wgDBname); |
286 | 280 | |
287 | 281 | wfProfileOut( $fname.'-MessageCache' ); |
288 | 282 | |
— | — | @@ -298,7 +292,6 @@ |
299 | 293 | # $wgLangClass = $wgContLangClass; |
300 | 294 | # $wgLanguageCode = $wgContLanguageCode; |
301 | 295 | # $wgLang = $wgContLang; |
302 | | -# $wgMessageCache = $wgContMessageCache; |
303 | 296 | # |
304 | 297 | # TODO: Need to change reference to $wgLang to $wgContLang at proper |
305 | 298 | # places, including namespaces, dates in signatures, magic words, |
— | — | @@ -338,6 +331,7 @@ |
339 | 332 | $wgParser = new Parser(); |
340 | 333 | $wgOut->setParserOptions( ParserOptions::newFromUser( $wgUser ) ); |
341 | 334 | $wgDBConnections = array(); |
| 335 | +$wgMsgParserOptions = ParserOptions::newFromUser($wgUser); |
342 | 336 | wfSeedRandom(); |
343 | 337 | |
344 | 338 | # Placeholders in case of DB error |