Index: trunk/phase3/languages/classes/LanguageRu.php |
— | — | @@ -56,8 +56,29 @@ |
57 | 57 | return $word; |
58 | 58 | } |
59 | 59 | |
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 | + |
62 | 83 | if ($count > 10 && floor(($count % 100) / 10) == 1) { |
63 | 84 | return $wordform3; |
64 | 85 | } else { |
— | — | @@ -84,3 +105,4 @@ |
85 | 106 | } |
86 | 107 | } |
87 | 108 | |
| 109 | + |