Index: trunk/phase3/includes/StubObject.php |
— | — | @@ -102,20 +102,19 @@ |
103 | 103 | } |
104 | 104 | |
105 | 105 | function _newObject() { |
106 | | - global $wgLanguageCode, $wgContLanguageCode, $wgRequest, $wgUser, $wgContLang; |
107 | | - // wgLanguageCode now specifically means the UI language |
108 | | - $wgLanguageCode = $wgRequest->getText('uselang', ''); |
109 | | - if ($wgLanguageCode == '') |
110 | | - $wgLanguageCode = $wgUser->getOption('language'); |
111 | | - # Validate $wgLanguageCode |
112 | | - if( empty( $wgLanguageCode ) || !preg_match( '/^[a-z]+(-[a-z]+)?$/', $wgLanguageCode ) ) { |
113 | | - $wgLanguageCode = $wgContLanguageCode; |
| 106 | + global $wgContLanguageCode, $wgRequest, $wgUser, $wgContLang; |
| 107 | + $code = $wgRequest->getText('uselang', ''); |
| 108 | + if ($code == '') |
| 109 | + $code = $wgUser->getOption('language'); |
| 110 | + # Validate $code |
| 111 | + if( empty( $code ) || !preg_match( '/^[a-z]+(-[a-z]+)?$/', $code ) ) { |
| 112 | + $code = $wgContLanguageCode; |
114 | 113 | } |
115 | 114 | |
116 | | - if( $wgLanguageCode == $wgContLanguageCode ) { |
| 115 | + if( $code == $wgContLanguageCode ) { |
117 | 116 | return $wgContLang; |
118 | 117 | } else { |
119 | | - $obj = Language::factory( $wgLanguageCode ); |
| 118 | + $obj = Language::factory( $code ); |
120 | 119 | return $obj; |
121 | 120 | } |
122 | 121 | } |
Index: trunk/phase3/includes/MessageCache.php |
— | — | @@ -414,15 +414,13 @@ |
415 | 415 | } |
416 | 416 | |
417 | 417 | function get( $key, $useDB = true, $forcontent = true, $isfullkey = false ) { |
418 | | - global $wgContLanguageCode, $wgContLang; |
| 418 | + global $wgContLanguageCode, $wgContLang, $wgLang; |
419 | 419 | if( $forcontent ) { |
420 | 420 | $lang =& $wgContLang; |
421 | | - $langcode = $wgContLanguageCode; |
422 | 421 | } else { |
423 | | - global $wgLang, $wgLanguageCode; |
424 | 422 | $lang =& $wgLang; |
425 | | - $langcode = $wgLanguageCode; |
426 | 423 | } |
| 424 | + $langcode = $lang->getCode(); |
427 | 425 | # If uninitialised, someone is trying to call this halfway through Setup.php |
428 | 426 | if( !$this->mInitialised ) { |
429 | 427 | return '<' . htmlspecialchars($key) . '>'; |
Index: trunk/phase3/includes/Setup.php |
— | — | @@ -82,6 +82,10 @@ |
83 | 83 | $wgMetaNamespace = str_replace( ' ', '_', $wgSitename ); |
84 | 84 | } |
85 | 85 | |
| 86 | +# These are now the same, always |
| 87 | +# To determine the user language, use $wgLang->getCode() |
| 88 | +$wgContLanguageCode = $wgLanguageCode; |
| 89 | + |
86 | 90 | wfProfileOut( $fname.'-misc1' ); |
87 | 91 | wfProfileIn( $fname.'-memcached' ); |
88 | 92 | |
— | — | @@ -133,11 +137,6 @@ |
134 | 138 | )); |
135 | 139 | } |
136 | 140 | |
137 | | -# $wgLanguageCode may be changed later to fit with user preference. |
138 | | -# The content language will remain fixed as per the configuration, |
139 | | -# so let's keep it. |
140 | | -$wgContLanguageCode = $wgLanguageCode; |
141 | | - |
142 | 141 | $wgLoadBalancer = new StubObject( 'wgLoadBalancer', 'LoadBalancer', |
143 | 142 | array( $wgDBservers, false, $wgMasterWaitTimeout, true ) ); |
144 | 143 | $wgContLang = new StubContLang; |
Index: trunk/phase3/includes/SpecialAllmessages.php |
— | — | @@ -62,10 +62,10 @@ |
63 | 63 | * |
64 | 64 | */ |
65 | 65 | function makePhp($messages) { |
66 | | - global $wgLanguageCode; |
| 66 | + global $wgLang; |
67 | 67 | $txt = "\n\n\$messages = array(\n"; |
68 | 68 | foreach( $messages as $key => $m ) { |
69 | | - if(strtolower($wgLanguageCode) != 'en' and $m['msg'] == $m['enmsg'] ) { |
| 69 | + if($wgLang->getCode() != 'en' and $m['msg'] == $m['enmsg'] ) { |
70 | 70 | //if (strstr($m['msg'],"\n")) { |
71 | 71 | // $txt.='/* '; |
72 | 72 | // $comment=' */'; |
— | — | @@ -90,7 +90,7 @@ |
91 | 91 | * |
92 | 92 | */ |
93 | 93 | function makeHTMLText( $messages ) { |
94 | | - global $wgLang, $wgUser, $wgLanguageCode, $wgContLanguageCode; |
| 94 | + global $wgLang, $wgContLang, $wgUser; |
95 | 95 | $fname = "makeHTMLText"; |
96 | 96 | wfProfileIn( $fname ); |
97 | 97 | |
— | — | @@ -148,8 +148,8 @@ |
149 | 149 | foreach( $messages as $key => $m ) { |
150 | 150 | |
151 | 151 | $title = $wgLang->ucfirst( $key ); |
152 | | - if($wgLanguageCode != $wgContLanguageCode) |
153 | | - $title.="/$wgLanguageCode"; |
| 152 | + if($wgLang->getCode() != $wgContLang->getCode()) |
| 153 | + $title.= '/' . $wgLang->getCode(); |
154 | 154 | |
155 | 155 | $titleObj =& Title::makeTitle( NS_MEDIAWIKI, $title ); |
156 | 156 | $talkPage =& Title::makeTitle( NS_MEDIAWIKI_TALK, $title ); |
Index: trunk/phase3/includes/QueryPage.php |
— | — | @@ -448,10 +448,10 @@ |
449 | 449 | } |
450 | 450 | |
451 | 451 | function feedTitle() { |
452 | | - global $wgLanguageCode, $wgSitename; |
| 452 | + global $wgContLanguageCode, $wgSitename; |
453 | 453 | $page = SpecialPage::getPage( $this->getName() ); |
454 | 454 | $desc = $page->getDescription(); |
455 | | - return "$wgSitename - $desc [$wgLanguageCode]"; |
| 455 | + return "$wgSitename - $desc [$wgContLanguageCode]"; |
456 | 456 | } |
457 | 457 | |
458 | 458 | function feedDesc() { |
Index: trunk/phase3/includes/Skin.php |
— | — | @@ -1438,7 +1438,7 @@ |
1439 | 1439 | */ |
1440 | 1440 | function buildSidebar() { |
1441 | 1441 | global $wgDBname, $parserMemc, $wgEnableSidebarCache; |
1442 | | - global $wgLanguageCode, $wgContLanguageCode; |
| 1442 | + global $wgLang, $wgContLang; |
1443 | 1443 | |
1444 | 1444 | $fname = 'SkinTemplate::buildSidebar'; |
1445 | 1445 | |
— | — | @@ -1446,7 +1446,7 @@ |
1447 | 1447 | |
1448 | 1448 | $key = "{$wgDBname}:sidebar"; |
1449 | 1449 | $cacheSidebar = $wgEnableSidebarCache && |
1450 | | - ($wgLanguageCode == $wgContLanguageCode); |
| 1450 | + ($wgLang->getCode() == $wgContLang->getCode()); |
1451 | 1451 | |
1452 | 1452 | if ($cacheSidebar) { |
1453 | 1453 | $cachedsidebar = $parserMemc->get( $key ); |