http://www.mediawiki.org/wiki/Special:Code/MediaWiki/89948
Revision: 89948
Author: nikerabbit
Date: 2011-06-13 07:47:39 +0000 (Mon, 13 Jun 2011)
Log Message:
-----------
* Fix I18nTags #languagename to use ParserOptions::getUserLang()
* Fix ParserOptions::getUserLang() to return code as documented
Modified Paths:
--------------
trunk/extensions/I18nTags/I18nTags_body.php
trunk/phase3/includes/parser/ParserOptions.php
Modified: trunk/extensions/I18nTags/I18nTags_body.php
===================================================================
--- trunk/extensions/I18nTags/I18nTags_body.php 2011-06-13 07:12:44 UTC (rev
89947)
+++ trunk/extensions/I18nTags/I18nTags_body.php 2011-06-13 07:47:39 UTC (rev
89948)
@@ -58,7 +58,7 @@
return '';
}
if ( !$outputLanguage ) {
- $outputLanguage = $wgLang->getCode();
+ $outputLanguage = $parser->getOptions()->getUserLang();
}
$cldr = is_callable( array( 'LanguageNames', 'getNames' ));
if ( $outputLanguage !== 'native' && $cldr ) {
Modified: trunk/phase3/includes/parser/ParserOptions.php
===================================================================
--- trunk/phase3/includes/parser/ParserOptions.php 2011-06-13 07:12:44 UTC
(rev 89947)
+++ trunk/phase3/includes/parser/ParserOptions.php 2011-06-13 07:47:39 UTC
(rev 89948)
@@ -114,6 +114,8 @@
* You shouldn't use this. Really. $parser->getFunctionLang() is all
you need.
* Using this fragments the cache and is discouraged. Yes, {{int: }}
uses this,
* producing inconsistent tables (Bug 14404).
+ * @return String Language code
+ * @since 1.17
*/
function getUserLang() {
$this->optionUsed('userlang');
@@ -143,7 +145,12 @@
function setCleanSignatures( $x ) { return wfSetVar(
$this->mCleanSignatures, $x ); }
function setExternalLinkTarget( $x ) { return wfSetVar(
$this->mExternalLinkTarget, $x ); }
function setMath( $x ) { return wfSetVar(
$this->mMath, $x ); }
- function setUserLang( $x ) { return wfSetVar(
$this->mUserLang, $x ); }
+ function setUserLang( $x ) {
+ if ( $x instanceof Language ) {
+ $x = $x->getCode();
+ }
+ return wfSetVar( $this->mUserLang, $x );
+ }
function setThumbSize( $x ) { return wfSetVar(
$this->mThumbSize, $x ); }
function setStubThreshold( $x ) { return wfSetVar(
$this->mStubThreshold, $x ); }
function setPreSaveTransform( $x ) { return wfSetVar(
$this->mPreSaveTransform, $x ); }
_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs