* (bug 5806) {{plural:}} support instead of "twin" MediaWiki messages
authorNiklas Laxström <nikerabbit@users.mediawiki.org>
Sat, 13 May 2006 10:14:48 +0000 (10:14 +0000)
committerNiklas Laxström <nikerabbit@users.mediawiki.org>
Sat, 13 May 2006 10:14:48 +0000 (10:14 +0000)
RELEASE-NOTES
includes/CategoryPage.php
includes/Skin.php
languages/Messages.php

index 9252aec..15266c0 100644 (file)
@@ -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 ==
 
index ff1fe0a..d574dda 100644 (file)
@@ -154,14 +154,14 @@ class CategoryPage extends Article {
                if( count( $children ) > 0 ) {
                        # Showing subcategories
                        $r .= '<h2>' . wfMsg( 'subcategories' ) . "</h2>\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 .= '<h2>' . wfMsg( 'category_header', $ti ) . "</h2>\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.
index d1be56e..3159131 100644 (file)
@@ -514,9 +514,9 @@ END;
                $pop = '</span>';
                $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 '';
        }
index fa4908b..26bfb6e 100644 (file)
@@ -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',