Index: branches/wmf/1.16wmf4/includes/parser/CoreParserFunctions.php |
— | — | @@ -81,7 +81,7 @@ |
82 | 82 | static function intFunction( $parser, $part1 = '' /*, ... */ ) { |
83 | 83 | if ( strval( $part1 ) !== '' ) { |
84 | 84 | $args = array_slice( func_get_args(), 2 ); |
85 | | - $message = wfMsgGetKey( $part1, true, false, false ); |
| 85 | + $message = wfMsgGetKey( $part1, true, $parser->getOptions()->getUserLang(), false ); |
86 | 86 | $message = wfMsgReplaceArgs( $message, $args ); |
87 | 87 | $message = $parser->replaceVariables( $message ); // like $wgMessageCache->transform() |
88 | 88 | return $message; |
Index: branches/wmf/1.16wmf4/includes/parser/ParserOptions.php |
— | — | @@ -29,6 +29,8 @@ |
30 | 30 | var $mEnableLimitReport; # Enable limit report in an HTML comment on output |
31 | 31 | var $mTimestamp; # Timestamp used for {{CURRENTDAY}} etc. |
32 | 32 | var $mExternalLinkTarget; # Target attribute for external links |
| 33 | + var $mMath; # User math preference (as integer) |
| 34 | + var $mUserLang; # Language code of the User language. |
33 | 35 | |
34 | 36 | var $mUser; # Stored user object, just used to initialise the skin |
35 | 37 | var $mIsPreview; # Parsing the page for a "preview" operation |
— | — | @@ -79,6 +81,15 @@ |
80 | 82 | return $this->mTimestamp; |
81 | 83 | } |
82 | 84 | |
| 85 | + /** |
| 86 | + * You shouldn't use this. Really. $parser->getFunctionLang() is all you need. |
| 87 | + * Using this fragments the cache and is discouraged. Yes, {{int: }} uses this, |
| 88 | + * producing inconsistent tables (Bug 14404). |
| 89 | + */ |
| 90 | + function getUserLang() { |
| 91 | + return $this->mUserLang; |
| 92 | + } |
| 93 | + |
83 | 94 | function setUseDynamicDates( $x ) { return wfSetVar( $this->mUseDynamicDates, $x ); } |
84 | 95 | function setInterwikiMagic( $x ) { return wfSetVar( $this->mInterwikiMagic, $x ); } |
85 | 96 | function setAllowExternalImages( $x ) { return wfSetVar( $this->mAllowExternalImages, $x ); } |
— | — | @@ -101,6 +112,9 @@ |
102 | 113 | function setTimestamp( $x ) { return wfSetVar( $this->mTimestamp, $x ); } |
103 | 114 | function setCleanSignatures( $x ) { return wfSetVar( $this->mCleanSignatures, $x ); } |
104 | 115 | function setExternalLinkTarget( $x ) { return wfSetVar( $this->mExternalLinkTarget, $x ); } |
| 116 | + function setMath( $x ) { return wfSetVar( $this->mMath, $x ); } |
| 117 | + function setUserLang( $x ) { return wfSetVar( $this->mUserLang, $x ); } |
| 118 | + |
105 | 119 | function setIsPreview( $x ) { return wfSetVar( $this->mIsPreview, $x ); } |
106 | 120 | function setIsSectionPreview( $x ) { return wfSetVar( $this->mIsSectionPreview, $x ); } |
107 | 121 | function setIsPrintable( $x ) { return wfSetVar( $this->mIsPrintable, $x ); } |
— | — | @@ -122,7 +136,7 @@ |
123 | 137 | global $wgUseDynamicDates, $wgInterwikiMagic, $wgAllowExternalImages; |
124 | 138 | global $wgAllowExternalImagesFrom, $wgEnableImageWhitelist, $wgAllowSpecialInclusion, $wgMaxArticleSize; |
125 | 139 | global $wgMaxPPNodeCount, $wgMaxTemplateDepth, $wgMaxPPExpandDepth, $wgCleanSignatures; |
126 | | - global $wgExternalLinkTarget; |
| 140 | + global $wgExternalLinkTarget, $wgLang; |
127 | 141 | |
128 | 142 | wfProfileIn( __METHOD__ ); |
129 | 143 | |
— | — | @@ -161,6 +175,9 @@ |
162 | 176 | $this->mEnableLimitReport = false; |
163 | 177 | $this->mCleanSignatures = $wgCleanSignatures; |
164 | 178 | $this->mExternalLinkTarget = $wgExternalLinkTarget; |
| 179 | + $this->mMath = $user->getOption( 'math' ); |
| 180 | + $this->mUserLang = $wgLang->getCode(); |
| 181 | + |
165 | 182 | $this->mIsPreview = false; |
166 | 183 | $this->mIsSectionPreview = false; |
167 | 184 | |
Index: branches/wmf/1.16wmf4/includes/MessageCache.php |
— | — | @@ -670,6 +670,7 @@ |
671 | 671 | $popts = $this->getParserOptions(); |
672 | 672 | $popts->setInterfaceMessage( $interface ); |
673 | 673 | $popts->setTargetLanguage( $language ); |
| 674 | + $popts->setUserLang( $language ); |
674 | 675 | $message = $this->mParser->transformMsg( $message, $popts ); |
675 | 676 | } |
676 | 677 | return $message; |