From: Siebrand Mazeland Date: Sun, 14 Sep 2008 09:06:14 +0000 (+0000) Subject: (bug 15569) Fix Russian commafy function. Patch by Alexander Sigachov. X-Git-Tag: 1.31.0-rc.0~45314 X-Git-Url: http://git.cyclocoop.org/%28?a=commitdiff_plain;h=63b932fb5fe0fcbf03cd96829b85b336d801bc93;p=lhc%2Fweb%2Fwiklou.git (bug 15569) Fix Russian commafy function. Patch by Alexander Sigachov. --- diff --git a/languages/classes/LanguageRu.php b/languages/classes/LanguageRu.php index d857920a51..5933b47aeb 100644 --- a/languages/classes/LanguageRu.php +++ b/languages/classes/LanguageRu.php @@ -92,14 +92,15 @@ class LanguageRu extends Language { } /* - * Russian numeric format is "12 345,67" but "1234,56" + * Four-digit number should be without group commas (spaces) + * See manual of style at http://ru.wikipedia.org/wiki/Википедия:Оформление_статей + * So "1 234 567", "12 345" but "1234" */ - function commafy($_) { - if (!preg_match('/^\d{1,4}$/',$_)) { - return strrev((string)preg_replace('/(\d{3})(?=\d)(?!\d*\.)/','$1,',strrev($_))); - } else { + if (preg_match('/^-?\d{1,4}(\.\d*)?$/',$_)) { return $_; + } else { + return strrev((string)preg_replace('/(\d{3})(?=\d)(?!\d*\.)/','$1,',strrev($_))); } } }