From 93daf64cb573359851bab5c8da1c3563350df8cf Mon Sep 17 00:00:00 2001 From: =?utf8?q?Niklas=20Laxstr=C3=B6m?= Date: Sat, 13 May 2006 10:14:48 +0000 Subject: [PATCH] * (bug 5806) {{plural:}} support instead of "twin" MediaWiki messages --- RELEASE-NOTES | 1 + includes/CategoryPage.php | 19 ++----------------- includes/Skin.php | 6 +++--- languages/Messages.php | 12 ++++-------- 4 files changed, 10 insertions(+), 28 deletions(-) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 9252aecd92..15266c0c72 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -250,6 +250,7 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN * (bug 5905) Plural support for Bosnian localisation (bs) * Groups which won't hit the rate limiter now configurable with $wgRateLimitsExcludedGroups +* (bug 5806) {{plural:}} support instead of "twin" MediaWiki messages == Compatibility == diff --git a/includes/CategoryPage.php b/includes/CategoryPage.php index ff1fe0a35a..d574ddade2 100644 --- a/includes/CategoryPage.php +++ b/includes/CategoryPage.php @@ -154,14 +154,14 @@ class CategoryPage extends Article { if( count( $children ) > 0 ) { # Showing subcategories $r .= '

' . wfMsg( 'subcategories' ) . "

\n"; - $r .= $this->formatCount( $children, 'subcategorycount' ); + $r .= wfMsgExt( 'subcategorycount', array( 'parse' ), count( $children) ); $r .= $this->formatList( $children, $children_start_char ); } # Showing articles in this category $ti = htmlspecialchars( $this->mTitle->getText() ); $r .= '

' . wfMsg( 'category_header', $ti ) . "

\n"; - $r .= $this->formatCount( $articles, 'categoryarticlecount' ); + $r .= wfMsgExt( 'categoryarticlecount', array( 'parse' ), count( $articles) ); $r .= $this->formatList( $articles, $articles_start_char ); if( $wgCategoryMagicGallery && ! $ig->isEmpty() ) { @@ -178,21 +178,6 @@ class CategoryPage extends Article { return $r; } - /** - * @param array $articles - * @param string $message - * @return string - * @private - */ - function formatCount( $articles, $message ) { - global $wgContLang; - $numart = count( $articles ); - if( $numart == 1 ) { - # Slightly different message to avoid silly plural - $message .= '1'; - } - return wfMsg( $message, $wgContLang->formatNum( $numart ) ); - } /** * Format a list of articles chunked by letter, either as a * bullet list or a columnar format, depending on the length. diff --git a/includes/Skin.php b/includes/Skin.php index d1be56eb47..3159131d2f 100644 --- a/includes/Skin.php +++ b/includes/Skin.php @@ -514,9 +514,9 @@ END; $pop = ''; $t = $embed . implode ( "{$pop} {$sep} {$embed}" , $wgOut->mCategoryLinks ) . $pop; - $msg = count( $wgOut->mCategoryLinks ) === 1 ? 'categories1' : 'categories'; + $msg = wfMsgExt('categories', array('parsemag', 'escape'), count( $wgOut->mCategoryLinks )); $s = $this->makeKnownLinkObj( Title::makeTitle( NS_SPECIAL, 'Categories' ), - wfMsg( $msg ), 'article=' . urlencode( $wgTitle->getPrefixedDBkey() ) ) + $msg, 'article=' . urlencode( $wgTitle->getPrefixedDBkey() ) ) . ': ' . $t; # optional 'dmoz-like' category browser. Will be shown under the list @@ -662,7 +662,7 @@ END; return wfMsg( $msg, $this->makeKnownLink( $wgContLang->SpecialPage( 'Undelete/' . $wgTitle->getPrefixedDBkey() ), - wfMsg( 'restorelink' . ($n == 1 ? '1' : ''), $n ) ) ); + wfMsgExt( 'restorelink', array( 'parsemag', 'escape' ), $n ) ) ); } return ''; } diff --git a/languages/Messages.php b/languages/Messages.php index fa4908baa2..26bfb6e290 100644 --- a/languages/Messages.php +++ b/languages/Messages.php @@ -107,8 +107,7 @@ parent class in order maintain consistency across languages. 'dec' => 'Dec', # Bits of text used by many pages: # -'categories1' => 'Category', -'categories' => 'Categories', +'categories' => '{{PLURAL:$1|Category|Categories}}', 'category' => 'category', 'category_header' => 'Articles in category "$1"', 'subcategories' => 'Subcategories', @@ -255,8 +254,7 @@ See $1.', 'hidetoc' => 'hide', 'thisisdeleted' => 'View or restore $1?', 'viewdeleted' => 'View $1?', -'restorelink1' => 'one deleted edit', -'restorelink' => '$1 deleted edits', +'restorelink' => '{{PLURAL:$1|one deleted edit|$1 deleted edits}}', 'feedlinks' => 'Feed:', 'sitenotice' => '-', # the equivalent to wgSiteNotice 'anonnotice' => '-', @@ -1490,10 +1488,8 @@ In the latter case you can also use a link, e.g. [[{{ns:Special}}:Export/{{Media 'spamprotectiontitle' => 'Spam protection filter', 'spamprotectiontext' => 'The page you wanted to save was blocked by the spam filter. This is probably caused by a link to an external site.', 'spamprotectionmatch' => 'The following text is what triggered our spam filter: $1', -'subcategorycount' => "There are $1 subcategories to this category.", -'subcategorycount1' => "There is $1 subcategory to this category.", -'categoryarticlecount' => "There are $1 articles in this category.", -'categoryarticlecount1' => "There is $1 article in this category.", +'subcategorycount' => "There {{PLURAL:$1|is one subcategory|are $1 subcategories}} to this category.", +'categoryarticlecount' => "There {{PLURAL:$1|is one article|are $1 articles}} in this category.", 'listingcontinuesabbrev' => " cont.", 'spambot_username' => 'MediaWiki spam cleanup', 'spam_reverting' => 'Reverting to last version not containing links to $1', -- 2.20.1