More documentation!
[lhc/web/wiklou.git] / languages / classes / LanguageDsb.php
1 <?php
2
3 /** Lower Sorbian (Dolnoserbski)
4 *
5 * @ingroup Language
6 */
7 class LanguageDsb extends Language {
8
9 /**
10 * Convert from the nominative form of a noun to some other case
11 * Invoked with {{grammar:case|word}}
12 *
13 * @param $word string
14 * @param $case string
15 * @return string
16 */
17 function convertGrammar( $word, $case ) {
18 global $wgGrammarForms;
19 if ( isset( $wgGrammarForms['dsb'][$case][$word] ) ) {
20 return $wgGrammarForms['dsb'][$case][$word];
21 }
22
23 switch ( $case ) {
24 case 'instrumental': # instrumental
25 $word = 'z ' . $word;
26 case 'lokatiw': # lokatiw
27 $word = 'wo ' . $word;
28 break;
29 }
30
31 return $word; # this will return the original value for 'nominatiw' (nominativ) and all undefined case values
32 }
33
34 /**
35 * @param $count int
36 * @param $forms array
37 * @return string
38 */
39 function convertPlural( $count, $forms ) {
40 if ( !count( $forms ) ) { return ''; }
41 $forms = $this->preConvertPlural( $forms, 4 );
42
43 switch ( abs( $count ) % 100 ) {
44 case 1: return $forms[0]; // singular
45 case 2: return $forms[1]; // dual
46 case 3:
47 case 4: return $forms[2]; // plural
48 default: return $forms[3]; // pluralgen
49 }
50 }
51 }