* {{PLURAL:}} now handles formatted numbers correctly
authorNiklas Laxström <nikerabbit@users.mediawiki.org>
Sat, 23 Dec 2006 18:58:44 +0000 (18:58 +0000)
committerNiklas Laxström <nikerabbit@users.mediawiki.org>
Sat, 23 Dec 2006 18:58:44 +0000 (18:58 +0000)
RELEASE-NOTES
includes/CoreParserFunctions.php
languages/Language.php

index 2ece536..da8b598 100644 (file)
@@ -397,6 +397,7 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN
   option to prevent this when running maintennace/update.php
 * (bug 7612) Remove superfluous link to Special:Categories from result items
   on Special:Mostcategories
+* {{PLURAL:}} now handles formatted numbers correctly
 
 == Languages updated ==
 
index 80280cf..7974893 100644 (file)
@@ -93,6 +93,7 @@ class CoreParserFunctions {
        }
 
        static function plural( $parser, $text = '', $arg0 = null, $arg1 = null, $arg2 = null, $arg3 = null, $arg4 = null ) {
+               $text = $parser->getFunctionLang()->parseFormattedNumber( $text );
                return $parser->getFunctionLang()->convertPlural( $text, $arg0, $arg1, $arg2, $arg3, $arg4 );
        }
 
index 2cd49cd..e0ad7e6 100644 (file)
@@ -1166,6 +1166,17 @@ class Language {
                return $number;
        }
 
+       function parseFormattedNumber( $number ) {
+               $s = $this->digitTransformTable();
+               if (!is_null($s)) { $number = strtr($number, array_flip($s)); }
+
+               $s = $this->separatorTransformTable();
+               if (!is_null($s)) { $number = strtr($number, array_flip($s)); }
+
+               $number = strtr( $number, array (',' => '') );
+               return $number;
+       }
+
        /**
         * Adds commas to a given number
         *