MediaWiki  REL1_21
LanguageBe_tarask.php
Go to the documentation of this file.
00001 <?php
00033 class LanguageBe_tarask extends Language {
00048         function convertPlural( $count, $forms ) {
00049                 if ( !count( $forms ) ) { return ''; }
00050 
00051                 // If the actual number is not mentioned in the expression, then just two forms are enough:
00052                 // singular for $count == 1
00053                 // plural   for $count != 1
00054                 // For example, "This user belongs to {{PLURAL:$1|one group|several groups}}."
00055                 if ( count( $forms ) === 2 ) return $count == 1 ? $forms[0] : $forms[1];
00056 
00057                 // @todo FIXME: CLDR defines 4 plural forms instead of 3
00058                 //        http://unicode.org/repos/cldr-tmp/trunk/diff/supplemental/language_plural_rules.html
00059                 $forms = $this->preConvertPlural( $forms, 3 );
00060 
00061                 if ( $count > 10 && floor( ( $count % 100 ) / 10 ) == 1 ) {
00062                         return $forms[2];
00063                 } else {
00064                         switch ( $count % 10 ) {
00065                                 case 1:  return $forms[0];
00066                                 case 2:
00067                                 case 3:
00068                                 case 4:  return $forms[1];
00069                                 default: return $forms[2];
00070                         }
00071                 }
00072         }
00073 
00084         function normalizeForSearch( $string ) {
00085                 wfProfileIn( __METHOD__ );
00086 
00087                 # MySQL fulltext index doesn't grok utf-8, so we
00088                 # need to fold cases and convert to hex
00089 
00090                 # Replacing apostrophe sign U+2019 with U+0027
00091                 $s = preg_replace( '/\xe2\x80\x99/', '\'', $string );
00092 
00093                 $s = parent::normalizeForSearch( $s );
00094 
00095                 wfProfileOut( __METHOD__ );
00096                 return $s;
00097         }
00098 
00107         function commafy( $_ ) {
00108                 if ( preg_match( '/^-?\d{1,4}(\.\d*)?$/', $_ ) ) {
00109                         return $_;
00110                 } else {
00111                         return strrev( (string)preg_replace( '/(\d{3})(?=\d)(?!\d*\.)/', '$1,', strrev( $_ ) ) );
00112                 }
00113         }
00114 }