Index: trunk/phase3/includes/GlobalFunctions.php |
— | — | @@ -564,16 +564,16 @@ |
565 | 565 | $options = array($options); |
566 | 566 | } |
567 | 567 | |
568 | | - $string = wfMsgGetKey( $key, true ); |
| 568 | + $string = wfMsgGetKey( $key, true, false, false ); |
569 | 569 | |
570 | 570 | if( !in_array('replaceafter', $options) ) { |
571 | 571 | $string = wfMsgReplaceArgs( $string, $args ); |
572 | 572 | } |
573 | 573 | |
574 | 574 | if( in_array('parse', $options) ) { |
575 | | - $string = $wgOut->parse( $string, true ); |
| 575 | + $string = $wgOut->parse( $string, true, true ); |
576 | 576 | } elseif ( in_array('parseinline', $options) ) { |
577 | | - $string = $wgOut->parse( $string, true ); |
| 577 | + $string = $wgOut->parse( $string, true, true ); |
578 | 578 | if( preg_match( "~^<p>(.*)\n?</p>$~", $string, $m = null ) ) { |
579 | 579 | $string = $m[1]; |
580 | 580 | } |
Index: trunk/phase3/includes/Parser.php |
— | — | @@ -2472,7 +2472,7 @@ |
2473 | 2473 | * @private |
2474 | 2474 | */ |
2475 | 2475 | function braceSubstitution( $piece ) { |
2476 | | - global $wgContLang, $wgAllowDisplayTitle, $action; |
| 2476 | + global $wgContLang, $wgLang, $wgAllowDisplayTitle, $action; |
2477 | 2477 | $fname = 'Parser::braceSubstitution'; |
2478 | 2478 | wfProfileIn( $fname ); |
2479 | 2479 | |
— | — | @@ -2624,11 +2624,12 @@ |
2625 | 2625 | } |
2626 | 2626 | } |
2627 | 2627 | |
| 2628 | + $lang = $this->mOptions->getInterfaceMessage() ? $wgLang : $wgContLang; |
2628 | 2629 | # GRAMMAR |
2629 | 2630 | if ( !$found && $argc == 1 ) { |
2630 | 2631 | $mwGrammar =& MagicWord::get( MAG_GRAMMAR ); |
2631 | 2632 | if ( $mwGrammar->matchStartAndRemove( $part1 ) ) { |
2632 | | - $text = $linestart . $wgContLang->convertGrammar( $args[0], $part1 ); |
| 2633 | + $text = $linestart . $lang->convertGrammar( $args[0], $part1 ); |
2633 | 2634 | $found = true; |
2634 | 2635 | } |
2635 | 2636 | } |
— | — | @@ -2638,7 +2639,7 @@ |
2639 | 2640 | $mwPluralForm =& MagicWord::get( MAG_PLURAL ); |
2640 | 2641 | if ( $mwPluralForm->matchStartAndRemove( $part1 ) ) { |
2641 | 2642 | 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]); |
2643 | 2644 | $found = true; |
2644 | 2645 | } |
2645 | 2646 | } |
— | — | @@ -4154,7 +4155,8 @@ |
4155 | 4156 | var $mEditSection; # Create "edit section" links |
4156 | 4157 | var $mNumberHeadings; # Automatically number headings |
4157 | 4158 | 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 |
4159 | 4161 | |
4160 | 4162 | function getUseTeX() { return $this->mUseTeX; } |
4161 | 4163 | function getUseDynamicDates() { return $this->mUseDynamicDates; } |
— | — | @@ -4166,7 +4168,8 @@ |
4167 | 4169 | function getEditSection() { return $this->mEditSection; } |
4168 | 4170 | function getNumberHeadings() { return $this->mNumberHeadings; } |
4169 | 4171 | function getAllowSpecialInclusion() { return $this->mAllowSpecialInclusion; } |
4170 | | - function getTidy() { return $this->mTidy; } |
| 4172 | + function getTidy() { return $this->mTidy; } |
| 4173 | + function getInterfaceMessage() { return $this->mInterfaceMessage; } |
4171 | 4174 | |
4172 | 4175 | function setUseTeX( $x ) { return wfSetVar( $this->mUseTeX, $x ); } |
4173 | 4176 | function setUseDynamicDates( $x ) { return wfSetVar( $this->mUseDynamicDates, $x ); } |
— | — | @@ -4177,8 +4180,9 @@ |
4178 | 4181 | function setEditSection( $x ) { return wfSetVar( $this->mEditSection, $x ); } |
4179 | 4182 | function setNumberHeadings( $x ) { return wfSetVar( $this->mNumberHeadings, $x ); } |
4180 | 4183 | 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); } |
4182 | 4185 | function setSkin( &$x ) { $this->mSkin =& $x; } |
| 4186 | + function setInterfaceMessage( $x ) { return wfSetVar( $this->mInterfaceMessage, $x); } |
4183 | 4187 | |
4184 | 4188 | function ParserOptions() { |
4185 | 4189 | global $wgUser; |
— | — | @@ -4221,6 +4225,7 @@ |
4222 | 4226 | $this->mNumberHeadings = $user->getOption( 'numberheadings' ); |
4223 | 4227 | $this->mAllowSpecialInclusion = $wgAllowSpecialInclusion; |
4224 | 4228 | $this->mTidy = false; |
| 4229 | + $this->mInterfaceMessage = false; |
4225 | 4230 | wfProfileOut( $fname ); |
4226 | 4231 | } |
4227 | 4232 | } |
Index: trunk/phase3/includes/OutputPage.php |
— | — | @@ -352,12 +352,14 @@ |
353 | 353 | } |
354 | 354 | |
355 | 355 | /** |
356 | | - * Parse wikitext and return the HTML. This is for special pages that add the text later |
| 356 | + * Parse wikitext and return the HTML. |
357 | 357 | */ |
358 | | - function parse( $text, $linestart = true ) { |
| 358 | + function parse( $text, $linestart = true, $interface = false ) { |
359 | 359 | global $wgParser, $wgTitle; |
| 360 | + if ( $interface) { $this->mParserOptions->setInterfaceMessage(true); } |
360 | 361 | $parserOutput = $wgParser->parse( $text, $wgTitle, $this->mParserOptions, |
361 | 362 | $linestart, true, $this->mRevisionId ); |
| 363 | + if ( $interface) { $this->mParserOptions->setInterfaceMessage(false); } |
362 | 364 | return $parserOutput->getText(); |
363 | 365 | } |
364 | 366 | |
Index: trunk/phase3/includes/SkinTemplate.php |
— | — | @@ -308,7 +308,7 @@ |
309 | 309 | if ( !$wgDisableCounters ) { |
310 | 310 | $viewcount = $wgLang->formatNum( $wgArticle->getCount() ); |
311 | 311 | if ( $viewcount ) { |
312 | | - $tpl->set('viewcount', wfMsg( "viewcount", $viewcount )); |
| 312 | + $tpl->set('viewcount', wfMsgExt( 'viewcount', array( 'parseinline' ), $viewcount ) ); |
313 | 313 | } else { |
314 | 314 | $tpl->set('viewcount', false); |
315 | 315 | } |
Index: trunk/phase3/includes/SpecialUserlogout.php |
— | — | @@ -18,7 +18,7 @@ |
19 | 19 | wfRunHooks('UserLogoutComplete', array(&$wgUser)); |
20 | 20 | |
21 | 21 | $wgOut->setRobotpolicy( 'noindex,nofollow' ); |
22 | | - $wgOut->addWikiText( wfMsg( 'logouttext' ) ); |
| 22 | + $wgOut->addHTML( wfMsgExt( 'logouttext', array( 'parse' ) ) ); |
23 | 23 | $wgOut->returnToMain(); |
24 | 24 | |
25 | 25 | } |
Index: trunk/phase3/includes/Skin.php |
— | — | @@ -893,7 +893,7 @@ |
894 | 894 | if ( !$wgDisableCounters ) { |
895 | 895 | $count = $wgLang->formatNum( $wgArticle->getCount() ); |
896 | 896 | if ( $count ) { |
897 | | - $s = wfMsg( 'viewcount', $count ); |
| 897 | + $s = wfMsgExt( 'viewcount', array( 'parseinline' ), $count ); |
898 | 898 | } |
899 | 899 | } |
900 | 900 | |
Index: trunk/phase3/RELEASE-NOTES |
— | — | @@ -138,6 +138,8 @@ |
139 | 139 | * (bug 5741) Introduce {{NUMBEROFUSERS}} magic word |
140 | 140 | * (bug 93) <nowiki> tags and tildes in templates |
141 | 141 | * 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 |
142 | 144 | |
143 | 145 | == Compatibility == |
144 | 146 | |
Index: trunk/phase3/languages/MessagesFi.php |
— | — | @@ -175,7 +175,7 @@ |
176 | 176 | 'redirectedfrom' => 'Uudelleenohjattu sivulta $1', |
177 | 177 | 'redirectpagesub' => 'Uudelleenohjaussivu', |
178 | 178 | '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}}.', |
180 | 180 | 'copyright' => 'Sisältö on käytettävissä lisenssillä $1.', |
181 | 181 | 'poweredby' => '{{GRAMMAR:genitive|{{SITENAME}}}} tarjoaa [http://www.mediawiki.org/ MediaWiki], avoimen lähdekoodin ohjelmisto.', |
182 | 182 | 'printsubtitle' => '(Lähde: {{SERVER}})', |
Index: trunk/phase3/languages/Messages.php |
— | — | @@ -211,7 +211,7 @@ |
212 | 212 | 'redirectedfrom' => '(Redirected from $1)', |
213 | 213 | 'redirectpagesub' => 'Redirect page', |
214 | 214 | '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}}.', |
216 | 216 | 'copyright' => 'Content is available under $1.', |
217 | 217 | 'protectedpage' => 'Protected page', |
218 | 218 | 'administrators' => 'Project:Administrators', |