From 0da0377d1fcb764b3f3b83cd16bd7a8ebc59dc17 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Niklas=20Laxstr=C3=B6m?= Date: Mon, 13 Jun 2011 07:47:39 +0000 Subject: [PATCH] * Fix I18nTags #languagename to use ParserOptions::getUserLang() * Fix ParserOptions::getUserLang() to return code as documented --- includes/parser/ParserOptions.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) 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 ); } -- 2.20.1