* (bug 24804) Corrected commafying in Polish and Ukrainian
authorAlexandre Emsenhuber <ialex@users.mediawiki.org>
Sat, 21 Aug 2010 14:57:08 +0000 (14:57 +0000)
committerAlexandre Emsenhuber <ialex@users.mediawiki.org>
Sat, 21 Aug 2010 14:57:08 +0000 (14:57 +0000)
RELEASE-NOTES
languages/classes/LanguagePl.php
languages/classes/LanguageUk.php

index 803038e..070dca3 100644 (file)
@@ -296,6 +296,7 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN
 * (bug 17031) Correct which characters the parser allows in tag attributes.
 * Save 200 useless queries on each category page view
 * Shell commands will now work on Linux in filesystems mounted noexec
+* (bug 24804) Corrected commafying in Polish and Ukrainian
 
 === API changes in 1.17 ===
 * (bug 22738) Allow filtering by action type on query=logevent.
index 1d96bc4..40477f4 100644 (file)
@@ -23,7 +23,7 @@ class LanguagePl extends Language {
        }
 
        function commafy( $_ ) {
-               if ( !preg_match( '/^\d{1,4}(.\d+)?$/', $_ ) ) {
+               if ( !preg_match( '/^\-?\d{1,4}(\.\d+)?$/', $_ ) ) {
                        return strrev( (string)preg_replace( '/(\d{3})(?=\d)(?!\d*\.)/', '$1,', strrev( $_ ) ) );
                } else {
                        return $_;
index 88655ff..6c0cf8d 100644 (file)
@@ -82,9 +82,8 @@ class LanguageUk extends Language {
        /*
         * Ukrainian numeric format is "12 345,67" but "1234,56"
         */
-
        function commafy( $_ ) {
-               if ( !preg_match( '/^\d{1,4}$/', $_ ) ) {
+               if ( !preg_match( '/^\-?\d{1,4}(\.\d+)?$/', $_ ) ) {
                        return strrev( (string)preg_replace( '/(\d{3})(?=\d)(?!\d*\.)/', '$1,', strrev( $_ ) ) );
                } else {
                        return $_;