* (bug 19286) Correct commafying function in Polish (pl)
[lhc/web/wiklou.git] / languages / classes / LanguagePl.php
1 <?php
2
3 /** Polish (polski)
4 *
5 * @ingroup Language
6 */
7 class LanguagePl extends Language {
8 function convertPlural( $count, $forms ) {
9 if ( !count($forms) ) { return ''; }
10 $forms = $this->preConvertPlural( $forms, 3 );
11 $count = abs( $count );
12 if ( $count == 1 )
13 return $forms[0]; // singular
14 switch ( $count % 10 ) {
15 case 2:
16 case 3:
17 case 4:
18 if ( $count / 10 % 10 != 1 )
19 return $forms[1]; // plural
20 default:
21 return $forms[2]; // plural genitive
22 }
23 }
24
25 function commafy($_) {
26 if (!preg_match('/^\d{1,4}(.\d+)?$/',$_)) {
27 return strrev((string)preg_replace('/(\d{3})(?=\d)(?!\d*\.)/','$1,',strrev($_)));
28 } else {
29 return $_;
30 }
31 }
32 }