r73975 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r73974‎ | r73975 | r73976 >
Date:19:26, 29 September 2010
Author:tomasz
Status:deferred
Tags:
Comment:
Merging in fix for int message translation
Modified paths:
  • /branches/wmf/1.16wmf4/includes/MessageCache.php (modified) (history)
  • /branches/wmf/1.16wmf4/includes/parser/CoreParserFunctions.php (modified) (history)
  • /branches/wmf/1.16wmf4/includes/parser/ParserOptions.php (modified) (history)

Diff [purge]

Index: branches/wmf/1.16wmf4/includes/parser/CoreParserFunctions.php
@@ -81,7 +81,7 @@
8282 static function intFunction( $parser, $part1 = '' /*, ... */ ) {
8383 if ( strval( $part1 ) !== '' ) {
8484 $args = array_slice( func_get_args(), 2 );
85 - $message = wfMsgGetKey( $part1, true, false, false );
 85+ $message = wfMsgGetKey( $part1, true, $parser->getOptions()->getUserLang(), false );
8686 $message = wfMsgReplaceArgs( $message, $args );
8787 $message = $parser->replaceVariables( $message ); // like $wgMessageCache->transform()
8888 return $message;
Index: branches/wmf/1.16wmf4/includes/parser/ParserOptions.php
@@ -29,6 +29,8 @@
3030 var $mEnableLimitReport; # Enable limit report in an HTML comment on output
3131 var $mTimestamp; # Timestamp used for {{CURRENTDAY}} etc.
3232 var $mExternalLinkTarget; # Target attribute for external links
 33+ var $mMath; # User math preference (as integer)
 34+ var $mUserLang; # Language code of the User language.
3335
3436 var $mUser; # Stored user object, just used to initialise the skin
3537 var $mIsPreview; # Parsing the page for a "preview" operation
@@ -79,6 +81,15 @@
8082 return $this->mTimestamp;
8183 }
8284
 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+
8394 function setUseDynamicDates( $x ) { return wfSetVar( $this->mUseDynamicDates, $x ); }
8495 function setInterwikiMagic( $x ) { return wfSetVar( $this->mInterwikiMagic, $x ); }
8596 function setAllowExternalImages( $x ) { return wfSetVar( $this->mAllowExternalImages, $x ); }
@@ -101,6 +112,9 @@
102113 function setTimestamp( $x ) { return wfSetVar( $this->mTimestamp, $x ); }
103114 function setCleanSignatures( $x ) { return wfSetVar( $this->mCleanSignatures, $x ); }
104115 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+
105119 function setIsPreview( $x ) { return wfSetVar( $this->mIsPreview, $x ); }
106120 function setIsSectionPreview( $x ) { return wfSetVar( $this->mIsSectionPreview, $x ); }
107121 function setIsPrintable( $x ) { return wfSetVar( $this->mIsPrintable, $x ); }
@@ -122,7 +136,7 @@
123137 global $wgUseDynamicDates, $wgInterwikiMagic, $wgAllowExternalImages;
124138 global $wgAllowExternalImagesFrom, $wgEnableImageWhitelist, $wgAllowSpecialInclusion, $wgMaxArticleSize;
125139 global $wgMaxPPNodeCount, $wgMaxTemplateDepth, $wgMaxPPExpandDepth, $wgCleanSignatures;
126 - global $wgExternalLinkTarget;
 140+ global $wgExternalLinkTarget, $wgLang;
127141
128142 wfProfileIn( __METHOD__ );
129143
@@ -161,6 +175,9 @@
162176 $this->mEnableLimitReport = false;
163177 $this->mCleanSignatures = $wgCleanSignatures;
164178 $this->mExternalLinkTarget = $wgExternalLinkTarget;
 179+ $this->mMath = $user->getOption( 'math' );
 180+ $this->mUserLang = $wgLang->getCode();
 181+
165182 $this->mIsPreview = false;
166183 $this->mIsSectionPreview = false;
167184
Index: branches/wmf/1.16wmf4/includes/MessageCache.php
@@ -670,6 +670,7 @@
671671 $popts = $this->getParserOptions();
672672 $popts->setInterfaceMessage( $interface );
673673 $popts->setTargetLanguage( $language );
 674+ $popts->setUserLang( $language );
674675 $message = $this->mParser->transformMsg( $message, $popts );
675676 }
676677 return $message;

Follow-up revisions

RevisionCommit summaryAuthorDate
r73982Picking up client side fix to go along with r73975tomasz20:32, 29 September 2010

Status & tagging log