From: Niklas Laxström Date: Mon, 13 Jun 2011 07:47:39 +0000 (+0000) Subject: * Fix I18nTags #languagename to use ParserOptions::getUserLang() X-Git-Tag: 1.31.0-rc.0~29562 X-Git-Url: https://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/banques/ajouter.php?a=commitdiff_plain;h=0da0377d1fcb764b3f3b83cd16bd7a8ebc59dc17;p=lhc%2Fweb%2Fwiklou.git * Fix I18nTags #languagename to use ParserOptions::getUserLang() * Fix ParserOptions::getUserLang() to return code as documented --- diff --git a/includes/parser/ParserOptions.php b/includes/parser/ParserOptions.php index 22cd231764..8dd545bbfc 100644 --- a/includes/parser/ParserOptions.php +++ b/includes/parser/ParserOptions.php @@ -114,6 +114,8 @@ class ParserOptions { * 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 @@ class ParserOptions { 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 ); }