* (bug 5741) Introduce {{NUMBEROFUSERS}} magic word
* (bug 93) <nowiki> tags and tildes in templates
* The returnto parameter is now actually used by SpecialUserlogin.php
+* Parser can now know that it is parsing an interface message
+* (bug 4737) MediaWiki:Viewcount supports {{PLURAL}} now
== Compatibility ==
$options = array($options);
}
- $string = wfMsgGetKey( $key, true );
+ $string = wfMsgGetKey( $key, true, false, false );
if( !in_array('replaceafter', $options) ) {
$string = wfMsgReplaceArgs( $string, $args );
}
if( in_array('parse', $options) ) {
- $string = $wgOut->parse( $string, true );
+ $string = $wgOut->parse( $string, true, true );
} elseif ( in_array('parseinline', $options) ) {
- $string = $wgOut->parse( $string, true );
+ $string = $wgOut->parse( $string, true, true );
if( preg_match( "~^<p>(.*)\n?</p>$~", $string, $m = null ) ) {
$string = $m[1];
}
}
/**
- * Parse wikitext and return the HTML. This is for special pages that add the text later
+ * Parse wikitext and return the HTML.
*/
- function parse( $text, $linestart = true ) {
+ function parse( $text, $linestart = true, $interface = false ) {
global $wgParser, $wgTitle;
+ if ( $interface) { $this->mParserOptions->setInterfaceMessage(true); }
$parserOutput = $wgParser->parse( $text, $wgTitle, $this->mParserOptions,
$linestart, true, $this->mRevisionId );
+ if ( $interface) { $this->mParserOptions->setInterfaceMessage(false); }
return $parserOutput->getText();
}
* @private
*/
function braceSubstitution( $piece ) {
- global $wgContLang, $wgAllowDisplayTitle, $action;
+ global $wgContLang, $wgLang, $wgAllowDisplayTitle, $action;
$fname = 'Parser::braceSubstitution';
wfProfileIn( $fname );
}
}
+ $lang = $this->mOptions->getInterfaceMessage() ? $wgLang : $wgContLang;
# GRAMMAR
if ( !$found && $argc == 1 ) {
$mwGrammar =& MagicWord::get( MAG_GRAMMAR );
if ( $mwGrammar->matchStartAndRemove( $part1 ) ) {
- $text = $linestart . $wgContLang->convertGrammar( $args[0], $part1 );
+ $text = $linestart . $lang->convertGrammar( $args[0], $part1 );
$found = true;
}
}
$mwPluralForm =& MagicWord::get( MAG_PLURAL );
if ( $mwPluralForm->matchStartAndRemove( $part1 ) ) {
if ($argc==2) {$args[2]=$args[1];}
- $text = $linestart . $wgContLang->convertPlural( $part1, $args[0], $args[1], $args[2]);
+ $text = $linestart . $lang->convertPlural( $part1, $args[0], $args[1], $args[2]);
$found = true;
}
}
var $mEditSection; # Create "edit section" links
var $mNumberHeadings; # Automatically number headings
var $mAllowSpecialInclusion; # Allow inclusion of special pages
- var $mTidy; # Ask for tidy cleanup
+ var $mTidy; # Ask for tidy cleanup
+ var $mInterfaceMessage; # Which lang to call for PLURAL and GRAMMAR
function getUseTeX() { return $this->mUseTeX; }
function getUseDynamicDates() { return $this->mUseDynamicDates; }
function getEditSection() { return $this->mEditSection; }
function getNumberHeadings() { return $this->mNumberHeadings; }
function getAllowSpecialInclusion() { return $this->mAllowSpecialInclusion; }
- function getTidy() { return $this->mTidy; }
+ function getTidy() { return $this->mTidy; }
+ function getInterfaceMessage() { return $this->mInterfaceMessage; }
function setUseTeX( $x ) { return wfSetVar( $this->mUseTeX, $x ); }
function setUseDynamicDates( $x ) { return wfSetVar( $this->mUseDynamicDates, $x ); }
function setEditSection( $x ) { return wfSetVar( $this->mEditSection, $x ); }
function setNumberHeadings( $x ) { return wfSetVar( $this->mNumberHeadings, $x ); }
function setAllowSpecialInclusion( $x ) { return wfSetVar( $this->mAllowSpecialInclusion, $x ); }
- function setTidy( $x ) { return wfSetVar( $this->mTidy, $x); }
+ function setTidy( $x ) { return wfSetVar( $this->mTidy, $x); }
function setSkin( &$x ) { $this->mSkin =& $x; }
+ function setInterfaceMessage( $x ) { return wfSetVar( $this->mInterfaceMessage, $x); }
function ParserOptions() {
global $wgUser;
$this->mNumberHeadings = $user->getOption( 'numberheadings' );
$this->mAllowSpecialInclusion = $wgAllowSpecialInclusion;
$this->mTidy = false;
+ $this->mInterfaceMessage = false;
wfProfileOut( $fname );
}
}
if ( !$wgDisableCounters ) {
$count = $wgLang->formatNum( $wgArticle->getCount() );
if ( $count ) {
- $s = wfMsg( 'viewcount', $count );
+ $s = wfMsgExt( 'viewcount', array( 'parseinline' ), $count );
}
}
if ( !$wgDisableCounters ) {
$viewcount = $wgLang->formatNum( $wgArticle->getCount() );
if ( $viewcount ) {
- $tpl->set('viewcount', wfMsg( "viewcount", $viewcount ));
+ $tpl->set('viewcount', wfMsgExt( 'viewcount', array( 'parseinline' ), $viewcount ) );
} else {
$tpl->set('viewcount', false);
}
wfRunHooks('UserLogoutComplete', array(&$wgUser));
$wgOut->setRobotpolicy( 'noindex,nofollow' );
- $wgOut->addWikiText( wfMsg( 'logouttext' ) );
+ $wgOut->addHTML( wfMsgExt( 'logouttext', array( 'parse' ) ) );
$wgOut->returnToMain();
}
'redirectedfrom' => '(Redirected from $1)',
'redirectpagesub' => 'Redirect page',
'lastmodified' => 'This page was last modified $1.',
-'viewcount' => 'This page has been accessed $1 times.',
+'viewcount' => 'This page has been accessed {{plural:$1|one time|$1 times}}.',
'copyright' => 'Content is available under $1.',
'protectedpage' => 'Protected page',
'administrators' => 'Project:Administrators',
'redirectedfrom' => 'Uudelleenohjattu sivulta $1',
'redirectpagesub' => 'Uudelleenohjaussivu',
'lastmodified' => 'Sivua on viimeksi muutettu $1.',
-'viewcount' => 'Tämä sivu on näytetty $1 kertaa.',
+'viewcount' => 'Tämä sivu on näytetty {{PLURAL:$1|yhden kerran|$1 kertaa}}.',
'copyright' => 'Sisältö on käytettävissä lisenssillä $1.',
'poweredby' => '{{GRAMMAR:genitive|{{SITENAME}}}} tarjoaa [http://www.mediawiki.org/ MediaWiki], avoimen lähdekoodin ohjelmisto.',
'printsubtitle' => '(Lähde: {{SERVER}})',