df3a1f993f6d9641479f2fcee27eab2acfcf5b0b
[lhc/web/wiklou.git] / languages / classes / LanguageSh.php
1 <?php
2 /**
3 *
4 * @ingroup Language
5 */
6 class LanguageSh extends Language {
7 function convertPlural( $count, $forms ) {
8 if ( !count( $forms ) ) { return ''; }
9
10 // if no number with word, then use $form[0] for singular and $form[1] for plural or zero
11 if ( count( $forms ) === 2 ) return $count == 1 ? $forms[0] : $forms[1];
12
13 // FIXME: CLDR defines 4 plural forms. Form with decimals missing.
14 // See http://unicode.org/repos/cldr-tmp/trunk/diff/supplemental/language_plural_rules.html#sh
15 $forms = $this->preConvertPlural( $forms, 3 );
16
17 if ( $count > 10 && floor( ( $count % 100 ) / 10 ) == 1 ) {
18 return $forms[2];
19 } else {
20 switch ( $count % 10 ) {
21 case 1: return $forms[0];
22 case 2:
23 case 3:
24 case 4: return $forms[1];
25 default: return $forms[2];
26 }
27 }
28 }
29 }