Index: trunk/phase3/tests/phpunit/includes/MessageTest.php |
— | — | @@ -37,7 +37,15 @@ |
38 | 38 | $this->assertEquals( '(Заглавная страница $1)', wfMessage( 'parentheses', 'Заглавная страница $1' )->plain() ); |
39 | 39 | $this->assertEquals( '(Заглавная страница)', wfMessage( 'parentheses' )->rawParams( 'Заглавная страница' )->plain() ); |
40 | 40 | $this->assertEquals( '(Заглавная страница $1)', wfMessage( 'parentheses' )->rawParams( 'Заглавная страница $1' )->plain() ); |
| 41 | + } |
41 | 42 | |
| 43 | + function testInContentLanguage() { |
| 44 | + global $wgLang, $wgForceUIMsgAsContentMsg; |
| 45 | + $wgLang = Language::factory( 'fr' ); |
| 46 | + |
| 47 | + $this->assertEquals( 'Main Page', wfMessage( 'mainpage' )->inContentLanguage()->plain(), "ForceUIMsg disabled" ); |
| 48 | + $wgForceUIMsgAsContentMsg[] = 'mainpage'; |
| 49 | + $this->assertEquals( 'Accueil', wfMessage( 'mainpage' )->inContentLanguage()->plain(), 'ForceUIMsg enabled' ); |
42 | 50 | } |
43 | 51 | |
44 | 52 | /** |
Index: trunk/phase3/includes/Message.php |
— | — | @@ -225,9 +225,15 @@ |
226 | 226 | |
227 | 227 | /** |
228 | 228 | * Request the message in the wiki's content language. |
| 229 | + * @see $wgForceUIMsgAsContentMsg |
229 | 230 | * @return Message: $this |
230 | 231 | */ |
231 | 232 | public function inContentLanguage() { |
| 233 | + global $wgForceUIMsgAsContentMsg; |
| 234 | + if ( in_array( $this->key, (array)$wgForceUIMsgAsContentMsg ) ) { |
| 235 | + return $this; |
| 236 | + } |
| 237 | + |
232 | 238 | global $wgContLang; |
233 | 239 | $this->interface = false; |
234 | 240 | $this->language = $wgContLang; |