Make intfunction go accross the ParserOptions.
Things like calling setUserLang( true ) to use the content language are unsupported and shouldn't be done.
This commit is contained in:
parent
6ccc20379e
commit
e1e71bde41
2 changed files with 13 additions and 2 deletions
|
|
@ -81,7 +81,7 @@ class CoreParserFunctions {
|
|||
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->mOptions->getUserLang(), false );
|
||||
$message = wfMsgReplaceArgs( $message, $args );
|
||||
$message = $parser->replaceVariables( $message ); // like $wgMessageCache->transform()
|
||||
return $message;
|
||||
|
|
|
|||
|
|
@ -29,6 +29,8 @@ class ParserOptions {
|
|||
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
|
||||
|
|
@ -85,6 +87,13 @@ class ParserOptions {
|
|||
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 ); }
|
||||
|
|
@ -108,6 +117,7 @@ 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 setIsPreview( $x ) { return wfSetVar( $this->mIsPreview, $x ); }
|
||||
function setIsSectionPreview( $x ) { return wfSetVar( $this->mIsSectionPreview, $x ); }
|
||||
|
|
@ -132,7 +142,7 @@ class ParserOptions {
|
|||
global $wgUseDynamicDates, $wgInterwikiMagic, $wgAllowExternalImages;
|
||||
global $wgAllowExternalImagesFrom, $wgEnableImageWhitelist, $wgAllowSpecialInclusion, $wgMaxArticleSize;
|
||||
global $wgMaxPPNodeCount, $wgMaxTemplateDepth, $wgMaxPPExpandDepth, $wgCleanSignatures;
|
||||
global $wgExternalLinkTarget;
|
||||
global $wgExternalLinkTarget, $wgLang;
|
||||
|
||||
wfProfileIn( __METHOD__ );
|
||||
|
||||
|
|
@ -172,6 +182,7 @@ class ParserOptions {
|
|||
$this->mCleanSignatures = $wgCleanSignatures;
|
||||
$this->mExternalLinkTarget = $wgExternalLinkTarget;
|
||||
$this->mMath = $user->getOption( 'math' );
|
||||
$this->mUserLang = $wgLang->getCode();
|
||||
|
||||
$this->mIsPreview = false;
|
||||
$this->mIsSectionPreview = false;
|
||||
|
|
|
|||
Loading…
Reference in a new issue