http://www.mediawiki.org/wiki/Special:Code/MediaWiki/89585
Revision: 89585
Author: nikerabbit
Date: 2011-06-06 17:55:19 +0000 (Mon, 06 Jun 2011)
Log Message:
-----------
Fix for bug 29274 - Message class ignores $wgForceUIMsgAsContentMsg
Also added tests, which pass
Modified Paths:
--------------
trunk/phase3/includes/Message.php
trunk/phase3/tests/phpunit/includes/MessageTest.php
Modified: trunk/phase3/includes/Message.php
===================================================================
--- trunk/phase3/includes/Message.php 2011-06-06 17:37:12 UTC (rev 89584)
+++ trunk/phase3/includes/Message.php 2011-06-06 17:55:19 UTC (rev 89585)
@@ -225,9 +225,15 @@
/**
* Request the message in the wiki's content language.
+ * @see $wgForceUIMsgAsContentMsg
* @return Message: $this
*/
public function inContentLanguage() {
+ global $wgForceUIMsgAsContentMsg;
+ if ( in_array( $this->key, (array)$wgForceUIMsgAsContentMsg ) )
{
+ return $this;
+ }
+
global $wgContLang;
$this->interface = false;
$this->language = $wgContLang;
Modified: trunk/phase3/tests/phpunit/includes/MessageTest.php
===================================================================
--- trunk/phase3/tests/phpunit/includes/MessageTest.php 2011-06-06 17:37:12 UTC
(rev 89584)
+++ trunk/phase3/tests/phpunit/includes/MessageTest.php 2011-06-06 17:55:19 UTC
(rev 89585)
@@ -37,7 +37,15 @@
$this->assertEquals( '(Заглавная страница $1)', wfMessage(
'parentheses', 'Заглавная страница $1' )->plain() );
$this->assertEquals( '(Заглавная страница)', wfMessage(
'parentheses' )->rawParams( 'Заглавная страница' )->plain() );
$this->assertEquals( '(Заглавная страница $1)', wfMessage(
'parentheses' )->rawParams( 'Заглавная страница $1' )->plain() );
+ }
+ function testInContentLanguage() {
+ global $wgLang, $wgForceUIMsgAsContentMsg;
+ $wgLang = Language::factory( 'fr' );
+
+ $this->assertEquals( 'Main Page', wfMessage( 'mainpage'
)->inContentLanguage()->plain(), "ForceUIMsg disabled" );
+ $wgForceUIMsgAsContentMsg[] = 'mainpage';
+ $this->assertEquals( 'Accueil', wfMessage( 'mainpage'
)->inContentLanguage()->plain(), 'ForceUIMsg enabled' );
}
/**
_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs