r13919 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r13918‎ | r13919 | r13920 >
Date:13:15, 29 April 2006
Author:nikerabbit
Status:old
Tags:
Comment:
* Parser can now know that it is parsing an interface message
* (bug 4737) MediaWiki:Viewcount supports {{PLURAL}} now
Modified paths:
  • /trunk/phase3/RELEASE-NOTES (modified) (history)
  • /trunk/phase3/includes/GlobalFunctions.php (modified) (history)
  • /trunk/phase3/includes/OutputPage.php (modified) (history)
  • /trunk/phase3/includes/Parser.php (modified) (history)
  • /trunk/phase3/includes/Skin.php (modified) (history)
  • /trunk/phase3/includes/SkinTemplate.php (modified) (history)
  • /trunk/phase3/includes/SpecialUserlogout.php (modified) (history)
  • /trunk/phase3/languages/Messages.php (modified) (history)
  • /trunk/phase3/languages/MessagesFi.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/GlobalFunctions.php
@@ -564,16 +564,16 @@
565565 $options = array($options);
566566 }
567567
568 - $string = wfMsgGetKey( $key, true );
 568+ $string = wfMsgGetKey( $key, true, false, false );
569569
570570 if( !in_array('replaceafter', $options) ) {
571571 $string = wfMsgReplaceArgs( $string, $args );
572572 }
573573
574574 if( in_array('parse', $options) ) {
575 - $string = $wgOut->parse( $string, true );
 575+ $string = $wgOut->parse( $string, true, true );
576576 } elseif ( in_array('parseinline', $options) ) {
577 - $string = $wgOut->parse( $string, true );
 577+ $string = $wgOut->parse( $string, true, true );
578578 if( preg_match( "~^<p>(.*)\n?</p>$~", $string, $m = null ) ) {
579579 $string = $m[1];
580580 }
Index: trunk/phase3/includes/Parser.php
@@ -2472,7 +2472,7 @@
24732473 * @private
24742474 */
24752475 function braceSubstitution( $piece ) {
2476 - global $wgContLang, $wgAllowDisplayTitle, $action;
 2476+ global $wgContLang, $wgLang, $wgAllowDisplayTitle, $action;
24772477 $fname = 'Parser::braceSubstitution';
24782478 wfProfileIn( $fname );
24792479
@@ -2624,11 +2624,12 @@
26252625 }
26262626 }
26272627
 2628+ $lang = $this->mOptions->getInterfaceMessage() ? $wgLang : $wgContLang;
26282629 # GRAMMAR
26292630 if ( !$found && $argc == 1 ) {
26302631 $mwGrammar =& MagicWord::get( MAG_GRAMMAR );
26312632 if ( $mwGrammar->matchStartAndRemove( $part1 ) ) {
2632 - $text = $linestart . $wgContLang->convertGrammar( $args[0], $part1 );
 2633+ $text = $linestart . $lang->convertGrammar( $args[0], $part1 );
26332634 $found = true;
26342635 }
26352636 }
@@ -2638,7 +2639,7 @@
26392640 $mwPluralForm =& MagicWord::get( MAG_PLURAL );
26402641 if ( $mwPluralForm->matchStartAndRemove( $part1 ) ) {
26412642 if ($argc==2) {$args[2]=$args[1];}
2642 - $text = $linestart . $wgContLang->convertPlural( $part1, $args[0], $args[1], $args[2]);
 2643+ $text = $linestart . $lang->convertPlural( $part1, $args[0], $args[1], $args[2]);
26432644 $found = true;
26442645 }
26452646 }
@@ -4154,7 +4155,8 @@
41554156 var $mEditSection; # Create "edit section" links
41564157 var $mNumberHeadings; # Automatically number headings
41574158 var $mAllowSpecialInclusion; # Allow inclusion of special pages
4158 - var $mTidy; # Ask for tidy cleanup
 4159+ var $mTidy; # Ask for tidy cleanup
 4160+ var $mInterfaceMessage; # Which lang to call for PLURAL and GRAMMAR
41594161
41604162 function getUseTeX() { return $this->mUseTeX; }
41614163 function getUseDynamicDates() { return $this->mUseDynamicDates; }
@@ -4166,7 +4168,8 @@
41674169 function getEditSection() { return $this->mEditSection; }
41684170 function getNumberHeadings() { return $this->mNumberHeadings; }
41694171 function getAllowSpecialInclusion() { return $this->mAllowSpecialInclusion; }
4170 - function getTidy() { return $this->mTidy; }
 4172+ function getTidy() { return $this->mTidy; }
 4173+ function getInterfaceMessage() { return $this->mInterfaceMessage; }
41714174
41724175 function setUseTeX( $x ) { return wfSetVar( $this->mUseTeX, $x ); }
41734176 function setUseDynamicDates( $x ) { return wfSetVar( $this->mUseDynamicDates, $x ); }
@@ -4177,8 +4180,9 @@
41784181 function setEditSection( $x ) { return wfSetVar( $this->mEditSection, $x ); }
41794182 function setNumberHeadings( $x ) { return wfSetVar( $this->mNumberHeadings, $x ); }
41804183 function setAllowSpecialInclusion( $x ) { return wfSetVar( $this->mAllowSpecialInclusion, $x ); }
4181 - function setTidy( $x ) { return wfSetVar( $this->mTidy, $x); }
 4184+ function setTidy( $x ) { return wfSetVar( $this->mTidy, $x); }
41824185 function setSkin( &$x ) { $this->mSkin =& $x; }
 4186+ function setInterfaceMessage( $x ) { return wfSetVar( $this->mInterfaceMessage, $x); }
41834187
41844188 function ParserOptions() {
41854189 global $wgUser;
@@ -4221,6 +4225,7 @@
42224226 $this->mNumberHeadings = $user->getOption( 'numberheadings' );
42234227 $this->mAllowSpecialInclusion = $wgAllowSpecialInclusion;
42244228 $this->mTidy = false;
 4229+ $this->mInterfaceMessage = false;
42254230 wfProfileOut( $fname );
42264231 }
42274232 }
Index: trunk/phase3/includes/OutputPage.php
@@ -352,12 +352,14 @@
353353 }
354354
355355 /**
356 - * Parse wikitext and return the HTML. This is for special pages that add the text later
 356+ * Parse wikitext and return the HTML.
357357 */
358 - function parse( $text, $linestart = true ) {
 358+ function parse( $text, $linestart = true, $interface = false ) {
359359 global $wgParser, $wgTitle;
 360+ if ( $interface) { $this->mParserOptions->setInterfaceMessage(true); }
360361 $parserOutput = $wgParser->parse( $text, $wgTitle, $this->mParserOptions,
361362 $linestart, true, $this->mRevisionId );
 363+ if ( $interface) { $this->mParserOptions->setInterfaceMessage(false); }
362364 return $parserOutput->getText();
363365 }
364366
Index: trunk/phase3/includes/SkinTemplate.php
@@ -308,7 +308,7 @@
309309 if ( !$wgDisableCounters ) {
310310 $viewcount = $wgLang->formatNum( $wgArticle->getCount() );
311311 if ( $viewcount ) {
312 - $tpl->set('viewcount', wfMsg( "viewcount", $viewcount ));
 312+ $tpl->set('viewcount', wfMsgExt( 'viewcount', array( 'parseinline' ), $viewcount ) );
313313 } else {
314314 $tpl->set('viewcount', false);
315315 }
Index: trunk/phase3/includes/SpecialUserlogout.php
@@ -18,7 +18,7 @@
1919 wfRunHooks('UserLogoutComplete', array(&$wgUser));
2020
2121 $wgOut->setRobotpolicy( 'noindex,nofollow' );
22 - $wgOut->addWikiText( wfMsg( 'logouttext' ) );
 22+ $wgOut->addHTML( wfMsgExt( 'logouttext', array( 'parse' ) ) );
2323 $wgOut->returnToMain();
2424
2525 }
Index: trunk/phase3/includes/Skin.php
@@ -893,7 +893,7 @@
894894 if ( !$wgDisableCounters ) {
895895 $count = $wgLang->formatNum( $wgArticle->getCount() );
896896 if ( $count ) {
897 - $s = wfMsg( 'viewcount', $count );
 897+ $s = wfMsgExt( 'viewcount', array( 'parseinline' ), $count );
898898 }
899899 }
900900
Index: trunk/phase3/RELEASE-NOTES
@@ -138,6 +138,8 @@
139139 * (bug 5741) Introduce {{NUMBEROFUSERS}} magic word
140140 * (bug 93) <nowiki> tags and tildes in templates
141141 * The returnto parameter is now actually used by SpecialUserlogin.php
 142+* Parser can now know that it is parsing an interface message
 143+* (bug 4737) MediaWiki:Viewcount supports {{PLURAL}} now
142144
143145 == Compatibility ==
144146
Index: trunk/phase3/languages/MessagesFi.php
@@ -175,7 +175,7 @@
176176 'redirectedfrom' => 'Uudelleenohjattu sivulta $1',
177177 'redirectpagesub' => 'Uudelleenohjaussivu',
178178 'lastmodified' => 'Sivua on viimeksi muutettu $1.',
179 -'viewcount' => 'Tämä sivu on näytetty $1 kertaa.',
 179+'viewcount' => 'Tämä sivu on näytetty {{PLURAL:$1|yhden kerran|$1 kertaa}}.',
180180 'copyright' => 'Sisältö on käytettävissä lisenssillä $1.',
181181 'poweredby' => '{{GRAMMAR:genitive|{{SITENAME}}}} tarjoaa [http://www.mediawiki.org/ MediaWiki], avoimen lähdekoodin ohjelmisto.',
182182 'printsubtitle' => '(Lähde: {{SERVER}})',
Index: trunk/phase3/languages/Messages.php
@@ -211,7 +211,7 @@
212212 'redirectedfrom' => '(Redirected from $1)',
213213 'redirectpagesub' => 'Redirect page',
214214 'lastmodified' => 'This page was last modified $1.',
215 -'viewcount' => 'This page has been accessed $1 times.',
 215+'viewcount' => 'This page has been accessed {{plural:$1|one time|$1 times}}.',
216216 'copyright' => 'Content is available under $1.',
217217 'protectedpage' => 'Protected page',
218218 'administrators' => 'Project:Administrators',

Status & tagging log