MediaWiki  REL1_19
LanguagePl.php
Go to the documentation of this file.
00001 <?php
00002 
00007 class LanguagePl extends Language {
00008 
00014         function convertPlural( $count, $forms ) {
00015                 if ( !count( $forms ) ) { return ''; }
00016                 $forms = $this->preConvertPlural( $forms, 3 );
00017                 $count = abs( $count );
00018                 if ( $count == 1 )
00019                         return $forms[0];     // singular
00020                 switch ( $count % 10 ) {
00021                         case 2:
00022                         case 3:
00023                         case 4:
00024                                 if ( $count / 10 % 10 != 1 )
00025                                         return $forms[1]; // plural
00026                         default:
00027                                 return $forms[2];   // plural genitive
00028                 }
00029         }
00030 
00035         function commafy( $_ ) {
00036                 if ( !preg_match( '/^\-?\d{1,4}(\.\d+)?$/', $_ ) ) {
00037                         return strrev( (string)preg_replace( '/(\d{3})(?=\d)(?!\d*\.)/', '$1,', strrev( $_ ) ) );
00038                 } else {
00039                         return $_;
00040                 }
00041         }
00042 }