r27313 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r27312‎ | r27313 | r27314 >
Date:13:59, 8 November 2007
Author:vasilievvv
Status:old
Tags:
Comment:
* (bug 11903) Upgrade of Russian convertPlural. Patch by Alexander Sigachov
Modified paths:
  • /trunk/phase3/languages/classes/LanguageRu.php (modified) (history)

Diff [purge]

Index: trunk/phase3/languages/classes/LanguageRu.php
@@ -56,8 +56,29 @@
5757 return $word;
5858 }
5959
60 - function convertPlural( $count, $wordform1, $wordform2, $wordform3, $w4, $w5) {
61 - $count = str_replace (' ', '', $count);
 60+ /**
 61+ * Plural form transformations
 62+ *
 63+ * $wordform1 - singular form (for 1, 21, 31, 41...)
 64+ * $wordform2 - paucal form (for 2, 3, 4, 22, 23, 24, 32, 33, 34...)
 65+ * $wordform3 - plural form (for 0, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 25, 26...)
 66+ * $wordform4 - plural form for messages without number
 67+ * $wordform5 - not used
 68+ *
 69+ * Examples:
 70+ * message with number
 71+ * "Сделано $1 {{PLURAL:$1|изменение|изменения|изменений}}"
 72+ * message without number
 73+ * "Действие не может быть выполнено по {{PLURAL:$1|следующей причине|||следующим причинам}}:"
 74+ *
 75+ */
 76+
 77+ function convertPlural( $count, $wordform1, $wordform2, $wordform3, $wordform4, $wordform5) {
 78+ $count=abs($count);
 79+
 80+ if ( $wordform4 && $count <> 1 )
 81+ return $wordform4;
 82+
6283 if ($count > 10 && floor(($count % 100) / 10) == 1) {
6384 return $wordform3;
6485 } else {
@@ -84,3 +105,4 @@
85106 }
86107 }
87108
 109+

Status & tagging log