r50259 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r50258‎ | r50259 | r50260 >
Date:12:02, 6 May 2009
Author:purodha
Status:resolved (Comments)
Tags:
Comment:
Internationalisation: three messages needing PLURAL, per requests in
http://translatewiki.net/w/i.php?title=Support&oldid=1208673#Extension:_Flagged_Revisions
Modified paths:
  • /trunk/extensions/FlaggedRevs/language/OldReviewedPages.i18n.php (modified) (history)
  • /trunk/extensions/FlaggedRevs/language/ReviewedPages.i18n.php (modified) (history)
  • /trunk/extensions/FlaggedRevs/language/StableVersions.i18n.php (modified) (history)
  • /trunk/extensions/FlaggedRevs/specialpages/OldReviewedPages_body.php (modified) (history)
  • /trunk/extensions/FlaggedRevs/specialpages/ReviewedPages_body.php (modified) (history)
  • /trunk/extensions/FlaggedRevs/specialpages/StableVersions_body.php (modified) (history)

Diff [purge]

Index: trunk/extensions/FlaggedRevs/language/StableVersions.i18n.php
@@ -12,7 +12,7 @@
1313 'stableversions-leg1' => 'List reviewed revisions for a page',
1414 'stableversions-page' => 'Page name:',
1515 'stableversions-none' => '"[[:$1]]" has no reviewed revisions.',
16 - 'stableversions-list' => 'The following is a list of revisions of [[:$1]] that have been reviewed:',
 16+ 'stableversions-list' => 'The following is a list of {{PLURAL:$2|the only revision|revisions}} of [[:$1]] that {{PLURAL:$2|has|have}} been reviewed:',
1717 'stableversions-review' => 'Reviewed on <i>$1</i> by $2',
1818 );
1919
@@ -27,7 +27,9 @@
2828 {{Identical|Page name}}',
2929 'stableversions-none' => '{{Flagged Revs}}
3030 Message is displayed on Special:Stableversions for pages that has no reviewed revisions. Parameter $1 is the pagename.',
31 - 'stableversions-list' => '{{Flagged Revs}}',
 31+ 'stableversions-list' => '{{Flagged Revs}}
 32+Parameter $1 is a page title,
 33+Parameter $2 is the count of revisions following, to be used with PLURAL.',
3234 'stableversions-review' => '{{Flagged Revs}}
3335 This message is used in the list of stable versions of a page (Special:Stableversions) to specify who has reviewed each version.
3436 Parameter $1 is the date and time of the review,
Index: trunk/extensions/FlaggedRevs/language/OldReviewedPages.i18n.php
@@ -36,7 +36,8 @@
3737 Title of [http://en.labs.wikimedia.org/wiki/Special:OldReviewedPages Special:OldReviewedPages].',
3838 'oldreviewedpages-legend' => '{{Flagged Revs-small}}
3939 Used on [http://en.labs.wikimedia.org/wiki/Special:OldReviewedPages Special:OldReviewedPages] as title/legend of the fieldset.',
40 - 'oldreviewedpages-list' => '{{Flagged Revs}}',
 40+ 'oldreviewedpages-list' => '{{Flagged Revs}}
 41+Parameter $1 is the number of pages going to be listed, to be used with PLURAL.',
4142 'oldreviewedpages-none' => '{{Flagged Revs}}',
4243 'oldreviewedpages-hours' => '{{Flagged Revs}}',
4344 'oldreviewedpages-days' => '{{Flagged Revs}}',
Index: trunk/extensions/FlaggedRevs/language/ReviewedPages.i18n.php
@@ -10,7 +10,7 @@
1111 $messages['en'] = array(
1212 'reviewedpages' => 'Reviewed pages',
1313 'reviewedpages-leg' => 'List pages by highest level',
14 - 'reviewedpages-list' => 'The following pages have been reviewed to the specified level',
 14+ 'reviewedpages-list' => 'The following {{PLURAL:$1|page has|pages have}} been reviewed to the specified level',
1515 'reviewedpages-none' => 'There are no pages in this list',
1616 'reviewedpages-lev-0' => '{{int:revreview-lev-sighted}}',
1717 'reviewedpages-lev-1' => '{{int:revreview-lev-quality}}',
@@ -26,7 +26,8 @@
2727 $messages['qqq'] = array(
2828 'reviewedpages' => '{{Flagged Revs}}',
2929 'reviewedpages-leg' => '{{Flagged Revs}}',
30 - 'reviewedpages-list' => '{{Flagged Revs}}',
 30+ 'reviewedpages-list' => '{{Flagged Revs}}
 31+Parameter $1 is the number of reviewed pages for use with PLURAL.',
3132 'reviewedpages-none' => '{{Flagged Revs}}
3233 {{Identical|There are no pages in this list}}',
3334 'reviewedpages-lev-0' => '{{Flagged Revs}}',
Index: trunk/extensions/FlaggedRevs/specialpages/StableVersions_body.php
@@ -41,9 +41,9 @@
4242 return;
4343 }
4444 $pager = new StableRevisionsPager( $this, array(), $this->page );
45 - if( $pager->getNumRows() ) {
46 - $wgOut->addHTML( wfMsgExt('stableversions-list', array('parse'),
47 - $this->page->getPrefixedText() ) );
 45+ if( $num = $pager->getNumRows() ) {
 46+ $wgOut->addHTML( wfMsgExt('stableversions-list', array('parse', 'parsemag'),
 47+ $this->page->getPrefixedText(), $num ) );
4848 $wgOut->addHTML( $pager->getNavigationBar() );
4949 $wgOut->addHTML( "<ul>" . $pager->getBody() . "</ul>" );
5050 $wgOut->addHTML( $pager->getNavigationBar() );
Index: trunk/extensions/FlaggedRevs/specialpages/OldReviewedPages_body.php
@@ -91,8 +91,9 @@
9292 # Add filter options
9393 $wgOut->addHTML( $form );
9494 # Add list output
95 - $wgOut->addHTML( wfMsgExt('oldreviewedpages-list', array('parse') ) );
96 - if( $pager->getNumRows() ) {
 95+ $num = $pager->getNumRows();
 96+ $wgOut->addHTML( wfMsgExt('oldreviewedpages-list', array('parse', 'parsemag'), $num ) );
 97+ if( $num ) {
9798 $wgOut->addHTML( $pager->getNavigationBar() );
9899 $wgOut->addHTML( $pager->getBody() );
99100 $wgOut->addHTML( $pager->getNavigationBar() );
Index: trunk/extensions/FlaggedRevs/specialpages/ReviewedPages_body.php
@@ -61,8 +61,8 @@
6262 global $wgOut, $wgUser, $wgLang;
6363
6464 $pager = new ReviewedPagesPager( $this, array(), $this->type, $this->namespace, $this->hideRedirs );
65 - if( $pager->getNumRows() ) {
66 - $wgOut->addHTML( wfMsgExt('reviewedpages-list', array('parse') ) );
 65+ if( $num = $pager->getNumRows() ) {
 66+ $wgOut->addHTML( wfMsgExt('reviewedpages-list', array('parse', 'parsemag'), $num ) );
6767 $wgOut->addHTML( $pager->getNavigationBar() );
6868 $wgOut->addHTML( $pager->getBody() );
6969 $wgOut->addHTML( $pager->getNavigationBar() );

Follow-up revisions

RevisionCommit summaryAuthorDate
r50335(r50259) Delete 'parsemag' in OldReviewedPages_body.php, ReviewedPages_body.p...jan16:51, 8 May 2009
r51150(r50259) Coding style changed as requested by Tim Starling at...purodha10:35, 29 May 2009

Comments

#Comment by Catrope (talk | contribs)   14:53, 6 May 2009

According to wfMsgExt()'s documentation, contradictory options such as parse and parsemag shouldn't be used together.

#Comment by Tim Starling (talk | contribs)   15:26, 25 May 2009

Don't use assignment in an if statement condition. It is surprising for the reader and looks like an error. Put the variable assignment and the if on separate lines:

$num = $pager->getNumRows();
if ( $num ) {
    ...
#Comment by Purodha (talk | contribs)   10:45, 29 May 2009

Done with r51150.
(I usually like less verbose code more because reading is quicker)
Btw. Do we code loop control w/o assignments, too?

while ( $row = mysql_fetch_array ( ...) ) {
    ...

is imho quite readable.
Do we have a coding style guide for easy reference of such questions?

#Comment by Tim Starling (talk | contribs)   09:52, 4 June 2009

I wrote some stuff here: ttp://www.mediawiki.org/wiki/Manual:Coding_conventions

Status & tagging log