* Reworked convertPlural so that it accepts variable number of arguments nicely
[lhc/web/wiklou.git] / languages / classes / LanguageCs.php
1 <?php
2 /** Czech (česky)
3 *
4 * @addtogroup Language
5 */
6
7 #--------------------------------------------------------------------------
8 # Internationalisation code
9 #--------------------------------------------------------------------------
10
11 class LanguageCs extends Language {
12 # Grammatical transformations, needed for inflected languages
13 # Invoked by putting {{grammar:case|word}} in a message
14 function convertGrammar( $word, $case ) {
15 global $wgGrammarForms;
16 if ( isset($wgGrammarForms['cs'][$case][$word]) ) {
17 return $wgGrammarForms['cs'][$case][$word];
18 }
19 # allowed values for $case:
20 # 1sg, 2sg, ..., 7sg -- nominative, genitive, ... (in singular)
21 switch ( $word ) {
22 case 'Wikibooks':
23 case 'Wikiknihy':
24 switch ( $case ) {
25 case '2sg':
26 return 'Wikiknih';
27 case '3sg':
28 return 'Wikiknihám';
29 case '6sg';
30 return 'Wikiknihách';
31 case '7sg':
32 return 'Wikiknihami';
33 default:
34 return 'Wikiknihy';
35 }
36 case 'Wikipedia':
37 case 'Wikipedie':
38 switch ( $case ) {
39 case '3sg':
40 case '4sg':
41 case '6sg':
42 return 'Wikipedii';
43 case '7sg':
44 return 'Wikipedií';
45 default:
46 return 'Wikipedie';
47 }
48
49 case 'Wiktionary':
50 case 'Wikcionář':
51 case 'Wikislovník':
52 switch ( $case ) {
53 case '2sg':
54 case '3sg':
55 case '5sg';
56 case '6sg';
57 return 'Wikislovníku';
58 case '7sg':
59 return 'Wikislovníkem';
60 default:
61 return 'Wikislovník';
62 }
63
64 case 'Wikiquote':
65 case 'Wikicitáty':
66 switch ( $case ) {
67 case '2sg':
68 return 'Wikicitátů';
69 case '3sg':
70 return 'Wikicitátům';
71 case '6sg';
72 return 'Wikicitátech';
73 default:
74 return 'Wikicitáty';
75 }
76 }
77 # unknown
78 return $word;
79 }
80
81 function convertPlural( $count, $forms ) {
82 if ( !count($forms) ) { return ''; }
83 $forms = $this->preConvertPlural( $forms, 3 );
84
85 switch ( $count ) {
86 case 1: return $forms[0];
87 case 2:
88 case 3:
89 case 4: return $forms[1];
90 default: return $forms[2];
91 }
92 }
93
94 }