MediaWiki
REL1_19
|
00001 <?php 00007 class LanguageSh extends Language { 00008 00014 function convertPlural( $count, $forms ) { 00015 if ( !count( $forms ) ) { return ''; } 00016 00017 // if no number with word, then use $form[0] for singular and $form[1] for plural or zero 00018 if ( count( $forms ) === 2 ) return $count == 1 ? $forms[0] : $forms[1]; 00019 00020 // @todo FIXME: CLDR defines 4 plural forms. Form with decimals missing. 00021 // See http://unicode.org/repos/cldr-tmp/trunk/diff/supplemental/language_plural_rules.html#sh 00022 $forms = $this->preConvertPlural( $forms, 3 ); 00023 00024 if ( $count > 10 && floor( ( $count % 100 ) / 10 ) == 1 ) { 00025 return $forms[2]; 00026 } else { 00027 switch ( $count % 10 ) { 00028 case 1: return $forms[0]; 00029 case 2: 00030 case 3: 00031 case 4: return $forms[1]; 00032 default: return $forms[2]; 00033 } 00034 } 00035 } 00036 }