Index: trunk/phase3/tests/phpunit/includes/ArticleTablesTest.php |
— | — | @@ -15,8 +15,8 @@ |
16 | 16 | function tearDown() { |
17 | 17 | global $wgLanguageCode, $wgContLang, $wgLang; |
18 | 18 | $wgLanguageCode = $this->languageCode; |
19 | | - $wgContLang = new StubContLang; |
20 | | - $wgLang = new StubUserLang; |
| 19 | + $wgContLang = Language::factory( $wgLanguageCode ); |
| 20 | + $wgLang = RequestContext::getMain()->getLang(); |
21 | 21 | } |
22 | 22 | |
23 | 23 | /** |
Index: trunk/phase3/tests/phpunit/includes/parser/NewParserTest.php |
— | — | @@ -76,7 +76,7 @@ |
77 | 77 | |
78 | 78 | // $tmpGlobals['wgContLang'] = new StubContLang; |
79 | 79 | $tmpGlobals['wgUser'] = new User; |
80 | | - $tmpGlobals['wgLang'] = new StubUserLang; |
| 80 | + $tmpGlobals['wgLang'] = Language::factory( 'en' ); |
81 | 81 | $tmpGlobals['wgOut'] = new StubObject( 'wgOut', 'OutputPage' ); |
82 | 82 | $tmpGlobals['wgParser'] = new StubObject( 'wgParser', $GLOBALS['wgParserConf']['class'], array( $GLOBALS['wgParserConf'] ) ); |
83 | 83 | $tmpGlobals['wgRequest'] = new WebRequest; |
Index: trunk/phase3/tests/phpunit/includes/ParserOptionsTest.php |
— | — | @@ -7,8 +7,8 @@ |
8 | 8 | |
9 | 9 | function setUp() { |
10 | 10 | ParserTest::setUp(); //reuse setup from parser tests |
11 | | - global $wgContLang, $wgUser; |
12 | | - $wgContLang = new StubContLang; |
| 11 | + global $wgContLang, $wgUser, $wgLanguageCode; |
| 12 | + $wgContLang = Language::factory( $wgLanguageCode ); |
13 | 13 | $this->popts = new ParserOptions( $wgUser ); |
14 | 14 | $this->pcache = ParserCache::singleton(); |
15 | 15 | } |
Index: trunk/phase3/tests/phpunit/suites/UploadFromUrlTestSuite.php |
— | — | @@ -48,7 +48,7 @@ |
49 | 49 | |
50 | 50 | // $wgContLang = new StubContLang; |
51 | 51 | $wgUser = new User; |
52 | | - $wgLang = new StubUserLang; |
| 52 | + $wgLang = Language::factory( 'en' ); |
53 | 53 | $wgOut = new StubObject( 'wgOut', 'OutputPage' ); |
54 | 54 | $wgParser = new StubObject( 'wgParser', $wgParserConf['class'], array( $wgParserConf ) ); |
55 | 55 | $wgRequest = new WebRequest; |
Index: trunk/phase3/tests/parser/parserTest.inc |
— | — | @@ -166,7 +166,7 @@ |
167 | 167 | |
168 | 168 | // $wgContLang = new StubContLang; |
169 | 169 | $wgUser = new User; |
170 | | - $wgLang = new StubUserLang; |
| 170 | + $wgLang = Language::factory( 'en' ); |
171 | 171 | $wgOut = new StubObject( 'wgOut', 'OutputPage' ); |
172 | 172 | $wgParser = new StubObject( 'wgParser', $wgParserConf['class'], array( $wgParserConf ) ); |
173 | 173 | $wgRequest = new WebRequest; |
Index: trunk/phase3/includes/StubObject.php |
— | — | @@ -110,6 +110,8 @@ |
111 | 111 | /** |
112 | 112 | * Stub object for the content language of this wiki. This object have to be in |
113 | 113 | * $wgContLang global. |
| 114 | + * |
| 115 | + * @deprecated since 1.18 |
114 | 116 | */ |
115 | 117 | class StubContLang extends StubObject { |
116 | 118 | |
— | — | @@ -134,6 +136,8 @@ |
135 | 137 | * Stub object for the user language. It depends of the user preferences and |
136 | 138 | * "uselang" parameter that can be passed to index.php. This object have to be |
137 | 139 | * in $wgLang global. |
| 140 | + * |
| 141 | + * @deprecated since 1.18 |
138 | 142 | */ |
139 | 143 | class StubUserLang extends StubObject { |
140 | 144 | |
Index: trunk/phase3/includes/Setup.php |
— | — | @@ -397,7 +397,9 @@ |
398 | 398 | wfProfileOut( $fname . '-session' ); |
399 | 399 | wfProfileIn( $fname . '-globals' ); |
400 | 400 | |
401 | | -$wgContLang = new StubContLang; |
| 401 | +$wgContLang = Language::factory( $wgLanguageCode ); |
| 402 | +$wgContLang->initEncoding(); |
| 403 | +$wgContLang->initContLang(); |
402 | 404 | |
403 | 405 | // Now that variant lists may be available... |
404 | 406 | $wgRequest->interpolateTitle(); |
— | — | @@ -406,7 +408,7 @@ |
407 | 409 | /** |
408 | 410 | * @var Language |
409 | 411 | */ |
410 | | -$wgLang = new StubUserLang; |
| 412 | +$wgLang = RequestContext::getMain()->getLang(); |
411 | 413 | |
412 | 414 | /** |
413 | 415 | * @var OutputPage |
Index: trunk/phase3/includes/Message.php |
— | — | @@ -208,7 +208,7 @@ |
209 | 209 | * @return Message: $this |
210 | 210 | */ |
211 | 211 | public function inLanguage( $lang ) { |
212 | | - if ( $lang instanceof Language || $lang instanceof StubContLang || $lang instanceof StubUserLang ) { |
| 212 | + if ( $lang instanceof Language ) { |
213 | 213 | $this->language = $lang; |
214 | 214 | } elseif ( is_string( $lang ) ) { |
215 | 215 | if( $this->language->getCode() != $lang ) { |
Index: trunk/phase3/languages/Language.php |
— | — | @@ -73,7 +73,11 @@ |
74 | 74 | */ |
75 | 75 | var $transformData = array(); |
76 | 76 | |
| 77 | + /** |
| 78 | + * @var LocalisationCache |
| 79 | + */ |
77 | 80 | static public $dataCache; |
| 81 | + |
78 | 82 | static public $mLangObjCache = array(); |
79 | 83 | |
80 | 84 | static public $mWeekdayMsgs = array( |