http://www.mediawiki.org/wiki/Special:Code/MediaWiki/73975

Revision: 73975
Author:   tomasz
Date:     2010-09-29 19:26:32 +0000 (Wed, 29 Sep 2010)

Log Message:
-----------
Merging in fix for int message translation

Modified Paths:
--------------
    branches/wmf/1.16wmf4/includes/MessageCache.php
    branches/wmf/1.16wmf4/includes/parser/CoreParserFunctions.php
    branches/wmf/1.16wmf4/includes/parser/ParserOptions.php

Modified: branches/wmf/1.16wmf4/includes/MessageCache.php
===================================================================
--- branches/wmf/1.16wmf4/includes/MessageCache.php     2010-09-29 19:08:54 UTC 
(rev 73974)
+++ branches/wmf/1.16wmf4/includes/MessageCache.php     2010-09-29 19:26:32 UTC 
(rev 73975)
@@ -670,6 +670,7 @@
                        $popts = $this->getParserOptions();
                        $popts->setInterfaceMessage( $interface );
                        $popts->setTargetLanguage( $language );
+                       $popts->setUserLang( $language );
                        $message = $this->mParser->transformMsg( $message, 
$popts );
                }
                return $message;

Modified: branches/wmf/1.16wmf4/includes/parser/CoreParserFunctions.php
===================================================================
--- branches/wmf/1.16wmf4/includes/parser/CoreParserFunctions.php       
2010-09-29 19:08:54 UTC (rev 73974)
+++ branches/wmf/1.16wmf4/includes/parser/CoreParserFunctions.php       
2010-09-29 19:26:32 UTC (rev 73975)
@@ -81,7 +81,7 @@
        static function intFunction( $parser, $part1 = '' /*, ... */ ) {
                if ( strval( $part1 ) !== '' ) {
                        $args = array_slice( func_get_args(), 2 );
-                       $message = wfMsgGetKey( $part1, true, false, false );
+                       $message = wfMsgGetKey( $part1, true, 
$parser->getOptions()->getUserLang(), false );
                        $message = wfMsgReplaceArgs( $message, $args );
                        $message = $parser->replaceVariables( $message ); // 
like $wgMessageCache->transform()
                        return $message;

Modified: branches/wmf/1.16wmf4/includes/parser/ParserOptions.php
===================================================================
--- branches/wmf/1.16wmf4/includes/parser/ParserOptions.php     2010-09-29 
19:08:54 UTC (rev 73974)
+++ branches/wmf/1.16wmf4/includes/parser/ParserOptions.php     2010-09-29 
19:26:32 UTC (rev 73975)
@@ -29,6 +29,8 @@
        var $mEnableLimitReport;         # Enable limit report in an HTML 
comment on output
        var $mTimestamp;                 # Timestamp used for {{CURRENTDAY}} 
etc.
        var $mExternalLinkTarget;        # Target attribute for external links
+       var $mMath;                      # User math preference (as integer)
+       var $mUserLang;                  # Language code of the User language.
 
        var $mUser;                      # Stored user object, just used to 
initialise the skin
        var $mIsPreview;                 # Parsing the page for a "preview" 
operation
@@ -79,6 +81,15 @@
                return $this->mTimestamp;
        }
 
+       /**
+        * 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).
+        */
+       function getUserLang() {
+               return $this->mUserLang;
+       }
+
        function setUseDynamicDates( $x )           { return wfSetVar( 
$this->mUseDynamicDates, $x ); }
        function setInterwikiMagic( $x )            { return wfSetVar( 
$this->mInterwikiMagic, $x ); }
        function setAllowExternalImages( $x )       { return wfSetVar( 
$this->mAllowExternalImages, $x ); }
@@ -101,6 +112,9 @@
        function setTimestamp( $x )                 { return wfSetVar( 
$this->mTimestamp, $x ); }
        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 setIsPreview( $x )                 { return wfSetVar( 
$this->mIsPreview, $x ); }
        function setIsSectionPreview( $x )          { return wfSetVar( 
$this->mIsSectionPreview, $x ); }
        function setIsPrintable( $x )               { return wfSetVar( 
$this->mIsPrintable, $x ); }
@@ -122,7 +136,7 @@
                global $wgUseDynamicDates, $wgInterwikiMagic, 
$wgAllowExternalImages;
                global $wgAllowExternalImagesFrom, $wgEnableImageWhitelist, 
$wgAllowSpecialInclusion, $wgMaxArticleSize;
                global $wgMaxPPNodeCount, $wgMaxTemplateDepth, 
$wgMaxPPExpandDepth, $wgCleanSignatures;
-               global $wgExternalLinkTarget;
+               global $wgExternalLinkTarget, $wgLang;
 
                wfProfileIn( __METHOD__ );
 
@@ -161,6 +175,9 @@
                $this->mEnableLimitReport = false;
                $this->mCleanSignatures = $wgCleanSignatures;
                $this->mExternalLinkTarget = $wgExternalLinkTarget;
+               $this->mMath = $user->getOption( 'math' );
+               $this->mUserLang = $wgLang->getCode();
+               
                $this->mIsPreview = false;
                $this->mIsSectionPreview = false;
 



_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to