Index: trunk/phase3/languages/classes/LanguageHr.php |
— | — | @@ -8,6 +8,8 @@ |
9 | 9 | |
10 | 10 | function convertPlural( $count, $forms ) { |
11 | 11 | if ( !count($forms) ) { return ''; } |
| 12 | + // FIXME: CLDR defines 4 plural forms instead of 3. Plural for for decimals is missing. |
| 13 | + // http://unicode.org/repos/cldr-tmp/trunk/diff/supplemental/language_plural_rules.html |
12 | 14 | $forms = $this->preConvertPlural( $forms, 3 ); |
13 | 15 | |
14 | 16 | if ($count > 10 && floor(($count % 100) / 10) == 1) { |
Index: trunk/phase3/languages/classes/LanguageLn.php |
— | — | @@ -0,0 +1,18 @@ |
| 2 | +<?php |
| 3 | +/** |
| 4 | + * |
| 5 | + * @ingroup Language |
| 6 | + */ |
| 7 | +class LanguageLn extends Language { |
| 8 | + /** |
| 9 | + * Use singular form for zero |
| 10 | + * http://unicode.org/repos/cldr-tmp/trunk/diff/supplemental/language_plural_rules.html#ln |
| 11 | + |
| 12 | + */ |
| 13 | + function convertPlural( $count, $forms ) { |
| 14 | + if ( !count($forms) ) { return ''; } |
| 15 | + $forms = $this->preConvertPlural( $forms, 2 ); |
| 16 | + |
| 17 | + return ($count <= 1) ? $forms[0] : $forms[1]; |
| 18 | + } |
| 19 | +} |
Property changes on: trunk/phase3/languages/classes/LanguageLn.php |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 20 | + native |
Added: svn:keywords |
2 | 21 | + Id |
Index: trunk/phase3/languages/classes/LanguageLv.php |
— | — | @@ -23,6 +23,9 @@ |
24 | 24 | */ |
25 | 25 | function convertPlural( $count, $forms ) { |
26 | 26 | if ( !count($forms) ) { return ''; } |
| 27 | + |
| 28 | + // FIXME: CLDR defines 3 plural forms instead of 2. Form for 0 is missing. |
| 29 | + // http://unicode.org/repos/cldr-tmp/trunk/diff/supplemental/language_plural_rules.html#lv |
27 | 30 | $forms = $this->preConvertPlural( $forms, 2 ); |
28 | 31 | |
29 | 32 | return ( ( $count % 10 == 1 ) && ( $count % 100 != 11 ) ) ? $forms[0] : $forms[1]; |
Index: trunk/phase3/languages/classes/LanguageMk.php |
— | — | @@ -0,0 +1,21 @@ |
| 2 | +<?php |
| 3 | +/** |
| 4 | + * |
| 5 | + * @ingroup Language |
| 6 | + */ |
| 7 | +class LanguageMk extends Language { |
| 8 | + /** |
| 9 | + * Plural forms per |
| 10 | + * http://unicode.org/repos/cldr-tmp/trunk/diff/supplemental/language_plural_rules.html#mk |
| 11 | + */ |
| 12 | + function convertPlural( $count, $forms ) { |
| 13 | + if ( !count($forms) ) { return ''; } |
| 14 | + $forms = $this->preConvertPlural( $forms, 2 ); |
| 15 | + |
| 16 | + if ($count > 10 && floor( ($count % 100 ) / 10 ) == 1 ) { |
| 17 | + return $forms[1]; |
| 18 | + } else { |
| 19 | + return $forms[0]; |
| 20 | + } |
| 21 | + } |
| 22 | +} |
Property changes on: trunk/phase3/languages/classes/LanguageMk.php |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 23 | + native |
Added: svn:keywords |
2 | 24 | + Id |
Index: trunk/phase3/languages/classes/LanguageMo.php |
— | — | @@ -0,0 +1,23 @@ |
| 2 | +<?php |
| 3 | +/** |
| 4 | + * |
| 5 | + * @ingroup Language |
| 6 | + */ |
| 7 | +class LanguageMo extends Language { |
| 8 | + function convertPlural( $count, $forms ) { |
| 9 | + // Plural rules per |
| 10 | + // http://unicode.org/repos/cldr-tmp/trunk/diff/supplemental/language_plural_rules.html#mo |
| 11 | + if ( !count($forms) ) { return ''; } |
| 12 | + |
| 13 | + $forms = $this->preConvertPlural( $forms, 3 ); |
| 14 | + |
| 15 | + if ( $count == 1 ) { |
| 16 | + $index = 0; |
| 17 | + } elseif ( $count == 0 || $count % 100 < 20 ) { |
| 18 | + $index = 1; |
| 19 | + } else { |
| 20 | + $index = 2; |
| 21 | + } |
| 22 | + return $forms[$index]; |
| 23 | + } |
| 24 | +} |
Property changes on: trunk/phase3/languages/classes/LanguageMo.php |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 25 | + native |
Added: svn:keywords |
2 | 26 | + Id |
Index: trunk/phase3/languages/classes/LanguageUk.php |
— | — | @@ -62,6 +62,8 @@ |
63 | 63 | //if no number with word, then use $form[0] for singular and $form[1] for plural or zero |
64 | 64 | if( count($forms) === 2 ) return $count == 1 ? $forms[0] : $forms[1]; |
65 | 65 | |
| 66 | + // FIXME: CLDR defines 4 plural forms. Form for decimals is missing/ |
| 67 | + // See http://unicode.org/repos/cldr-tmp/trunk/diff/supplemental/language_plural_rules.html#uk |
66 | 68 | $forms = $this->preConvertPlural( $forms, 3 ); |
67 | 69 | |
68 | 70 | if ($count > 10 && floor(($count % 100) / 10) == 1) { |
Index: trunk/phase3/languages/classes/LanguageBs.php |
— | — | @@ -10,6 +10,8 @@ |
11 | 11 | if ( !count($forms) ) { return ''; } |
12 | 12 | $forms = $this->preConvertPlural( $forms, 3 ); |
13 | 13 | |
| 14 | + // FIXME: CLDR defines 4 plural forms instead of 3. Plural for decimals is missing. |
| 15 | + // http://unicode.org/repos/cldr-tmp/trunk/diff/supplemental/language_plural_rules.html |
14 | 16 | if ($count > 10 && floor(($count % 100) / 10) == 1) { |
15 | 17 | return $forms[2]; |
16 | 18 | } else { |
Index: trunk/phase3/languages/classes/LanguageRo.php |
— | — | @@ -0,0 +1,23 @@ |
| 2 | +<?php |
| 3 | +/** |
| 4 | + * |
| 5 | + * @ingroup Language |
| 6 | + */ |
| 7 | +class LanguageRo extends Language { |
| 8 | + function convertPlural( $count, $forms ) { |
| 9 | + // Plural rules per |
| 10 | + // http://unicode.org/repos/cldr-tmp/trunk/diff/supplemental/language_plural_rules.html#ro |
| 11 | + if ( !count($forms) ) { return ''; } |
| 12 | + |
| 13 | + $forms = $this->preConvertPlural( $forms, 3 ); |
| 14 | + |
| 15 | + if ( $count == 1 ) { |
| 16 | + $index = 0; |
| 17 | + } elseif ( $count == 0 || $count % 100 < 20 ) { |
| 18 | + $index = 1; |
| 19 | + } else { |
| 20 | + $index = 2; |
| 21 | + } |
| 22 | + return $forms[$index]; |
| 23 | + } |
| 24 | +} |
Property changes on: trunk/phase3/languages/classes/LanguageRo.php |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 25 | + native |
Added: svn:keywords |
2 | 26 | + Id |
Index: trunk/phase3/languages/classes/LanguageSma.php |
— | — | @@ -0,0 +1,22 @@ |
| 2 | +<?php |
| 3 | +/** |
| 4 | + * |
| 5 | + * @ingroup Language |
| 6 | + */ |
| 7 | +class LanguageSma extends Language { |
| 8 | + function convertPlural( $count, $forms ) { |
| 9 | + if ( !count($forms) ) { return ''; } |
| 10 | + |
| 11 | + // plural forms per http://unicode.org/repos/cldr-tmp/trunk/diff/supplemental/language_plural_rules.html#sma |
| 12 | + $forms = $this->preConvertPlural( $forms, 3 ); |
| 13 | + |
| 14 | + if ( $count == 1 ) { |
| 15 | + $index = 1; |
| 16 | + } elseif( $count == 2 ) { |
| 17 | + $index = 2; |
| 18 | + } else { |
| 19 | + $index = 3; |
| 20 | + } |
| 21 | + return $forms[$index]; |
| 22 | + } |
| 23 | +} |
Property changes on: trunk/phase3/languages/classes/LanguageSma.php |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 24 | + native |
Added: svn:keywords |
2 | 25 | + Id |
Index: trunk/phase3/languages/classes/LanguageRu.php |
— | — | @@ -76,6 +76,8 @@ |
77 | 77 | //if no number with word, then use $form[0] for singular and $form[1] for plural or zero |
78 | 78 | if( count($forms) === 2 ) return $count == 1 ? $forms[0] : $forms[1]; |
79 | 79 | |
| 80 | + // FIXME: CLDR defines 4 plural forms. Form with decimals missing. |
| 81 | + // See http://unicode.org/repos/cldr-tmp/trunk/diff/supplemental/language_plural_rules.html#ru |
80 | 82 | $forms = $this->preConvertPlural( $forms, 3 ); |
81 | 83 | |
82 | 84 | if ($count > 10 && floor(($count % 100) / 10) == 1) { |
Index: trunk/phase3/languages/classes/LanguageGa.php |
— | — | @@ -34,4 +34,20 @@ |
35 | 35 | } |
36 | 36 | return $word; |
37 | 37 | } |
| 38 | + |
| 39 | + function convertPlural( $count, $forms ) { |
| 40 | + if ( !count($forms) ) { return ''; } |
| 41 | + |
| 42 | + // plural forms per http://unicode.org/repos/cldr-tmp/trunk/diff/supplemental/language_plural_rules.html#ga |
| 43 | + $forms = $this->preConvertPlural( $forms, 3 ); |
| 44 | + |
| 45 | + if ( $count == 1 ) { |
| 46 | + $index = 1; |
| 47 | + } elseif( $count == 2 ) { |
| 48 | + $index = 2; |
| 49 | + } else { |
| 50 | + $index = 3; |
| 51 | + } |
| 52 | + return $forms[$index]; |
| 53 | + } |
38 | 54 | } |
Index: trunk/phase3/languages/classes/LanguageBe_tarask.php |
— | — | @@ -25,6 +25,8 @@ |
26 | 26 | //if no number with word, then use $form[0] for singular and $form[1] for plural or zero |
27 | 27 | if( count($forms) === 2 ) return $count == 1 ? $forms[0] : $forms[1]; |
28 | 28 | |
| 29 | + // FIXME: CLDR defines 4 plural forms instead of 3 |
| 30 | + // http://unicode.org/repos/cldr-tmp/trunk/diff/supplemental/language_plural_rules.html |
29 | 31 | $forms = $this->preConvertPlural( $forms, 3 ); |
30 | 32 | |
31 | 33 | if ($count > 10 && floor(($count % 100) / 10) == 1) { |
Index: trunk/phase3/languages/classes/LanguageSe.php |
— | — | @@ -0,0 +1,22 @@ |
| 2 | +<?php |
| 3 | +/** |
| 4 | + * |
| 5 | + * @ingroup Language |
| 6 | + */ |
| 7 | +class LanguageSe extends Language { |
| 8 | + function convertPlural( $count, $forms ) { |
| 9 | + if ( !count($forms) ) { return ''; } |
| 10 | + |
| 11 | + // plural forms per http://unicode.org/repos/cldr-tmp/trunk/diff/supplemental/language_plural_rules.html#se |
| 12 | + $forms = $this->preConvertPlural( $forms, 3 ); |
| 13 | + |
| 14 | + if ( $count == 1 ) { |
| 15 | + $index = 1; |
| 16 | + } elseif( $count == 2 ) { |
| 17 | + $index = 2; |
| 18 | + } else { |
| 19 | + $index = 3; |
| 20 | + } |
| 21 | + return $forms[$index]; |
| 22 | + } |
| 23 | +} |
Property changes on: trunk/phase3/languages/classes/LanguageSe.php |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 24 | + native |
Added: svn:keywords |
2 | 25 | + Id |
Index: trunk/phase3/languages/classes/LanguageSh.php |
— | — | @@ -0,0 +1,29 @@ |
| 2 | +<?php |
| 3 | +/** |
| 4 | + * |
| 5 | + * @ingroup Language |
| 6 | + */ |
| 7 | +class LanguageSh extends Language { |
| 8 | + function convertPlural( $count, $forms ) { |
| 9 | + if ( !count($forms) ) { return ''; } |
| 10 | + |
| 11 | + //if no number with word, then use $form[0] for singular and $form[1] for plural or zero |
| 12 | + if( count($forms) === 2 ) return $count == 1 ? $forms[0] : $forms[1]; |
| 13 | + |
| 14 | + // FIXME: CLDR defines 4 plural forms. Form with decimals missing. |
| 15 | + // See http://unicode.org/repos/cldr-tmp/trunk/diff/supplemental/language_plural_rules.html#sh |
| 16 | + $forms = $this->preConvertPlural( $forms, 3 ); |
| 17 | + |
| 18 | + if ($count > 10 && floor(($count % 100) / 10) == 1) { |
| 19 | + return $forms[2]; |
| 20 | + } else { |
| 21 | + switch ($count % 10) { |
| 22 | + case 1: return $forms[0]; |
| 23 | + case 2: |
| 24 | + case 3: |
| 25 | + case 4: return $forms[1]; |
| 26 | + default: return $forms[2]; |
| 27 | + } |
| 28 | + } |
| 29 | + } |
| 30 | +} |
Property changes on: trunk/phase3/languages/classes/LanguageSh.php |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 31 | + native |
Added: svn:keywords |
2 | 32 | + Id |
Index: trunk/phase3/languages/classes/LanguageCy.php |
— | — | @@ -8,6 +8,9 @@ |
9 | 9 | class LanguageCy extends Language { |
10 | 10 | function convertPlural( $count, $forms ) { |
11 | 11 | if ( !count($forms) ) { return ''; } |
| 12 | + |
| 13 | + // FIXME: CLDR defines 4 plural forms; very different, actually. |
| 14 | + // See http://unicode.org/repos/cldr-tmp/trunk/diff/supplemental/language_plural_rules.html#cy |
12 | 15 | $forms = $this->preConvertPlural( $forms, 6 ); |
13 | 16 | $count = abs( $count ); |
14 | 17 | if ( $count >= 0 && $count <= 3 ) { |
Index: trunk/phase3/languages/classes/LanguageSr.php |
— | — | @@ -183,4 +183,27 @@ |
184 | 184 | $this->mConverter = new SrConverter($this, 'sr', $variants, $variantfallbacks, $marker, $flags); |
185 | 185 | $wgHooks['ArticleSaveComplete'][] = $this->mConverter; |
186 | 186 | } |
| 187 | + |
| 188 | + function convertPlural( $count, $forms ) { |
| 189 | + if ( !count($forms) ) { return ''; } |
| 190 | + |
| 191 | + //if no number with word, then use $form[0] for singular and $form[1] for plural or zero |
| 192 | + if( count($forms) === 2 ) return $count == 1 ? $forms[0] : $forms[1]; |
| 193 | + |
| 194 | + // FIXME: CLDR defines 4 plural forms. Form with decimals missing. |
| 195 | + // See http://unicode.org/repos/cldr-tmp/trunk/diff/supplemental/language_plural_rules.html#ru |
| 196 | + $forms = $this->preConvertPlural( $forms, 3 ); |
| 197 | + |
| 198 | + if ($count > 10 && floor(($count % 100) / 10) == 1) { |
| 199 | + return $forms[2]; |
| 200 | + } else { |
| 201 | + switch ($count % 10) { |
| 202 | + case 1: return $forms[0]; |
| 203 | + case 2: |
| 204 | + case 3: |
| 205 | + case 4: return $forms[1]; |
| 206 | + default: return $forms[2]; |
| 207 | + } |
| 208 | + } |
| 209 | + } |
187 | 210 | } |