MediaWiki  REL1_20
LanguageSh.php
Go to the documentation of this file.
00001 <?php
00029 class LanguageSh extends Language {
00030 
00036         function convertPlural( $count, $forms ) {
00037                 if ( !count( $forms ) ) { return ''; }
00038 
00039                 // if no number with word, then use $form[0] for singular and $form[1] for plural or zero
00040                 if ( count( $forms ) === 2 ) return $count == 1 ? $forms[0] : $forms[1];
00041 
00042                 // @todo FIXME: CLDR defines 4 plural forms. Form with decimals missing.
00043                 // See http://unicode.org/repos/cldr-tmp/trunk/diff/supplemental/language_plural_rules.html#sh
00044                 $forms = $this->preConvertPlural( $forms, 3 );
00045 
00046                 if ( $count > 10 && floor( ( $count % 100 ) / 10 ) == 1 ) {
00047                         return $forms[2];
00048                 } else {
00049                         switch ( $count % 10 ) {
00050                                 case 1:  return $forms[0];
00051                                 case 2:
00052                                 case 3:
00053                                 case 4:  return $forms[1];
00054                                 default: return $forms[2];
00055                         }
00056                 }
00057         }
00058 }