From c3b2f94cb9004301ed686345e8347bba99f73262 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Niklas=20Laxstr=C3=B6m?= Date: Sat, 23 Dec 2006 18:58:44 +0000 Subject: [PATCH] * {{PLURAL:}} now handles formatted numbers correctly --- RELEASE-NOTES | 1 + includes/CoreParserFunctions.php | 1 + languages/Language.php | 11 +++++++++++ 3 files changed, 13 insertions(+) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 2ece5367e3..da8b598e2d 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -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 == diff --git a/includes/CoreParserFunctions.php b/includes/CoreParserFunctions.php index 80280cf272..7974893ede 100644 --- a/includes/CoreParserFunctions.php +++ b/includes/CoreParserFunctions.php @@ -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 ); } diff --git a/languages/Language.php b/languages/Language.php index 2cd49cdbbf..e0ad7e678b 100644 --- a/languages/Language.php +++ b/languages/Language.php @@ -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 * -- 2.20.1