Some language love
[lhc/web/wiklou.git] / languages / classes / LanguageBs.php
1 <?php
2
3 /** Bosnian (bosanski)
4 *
5 * @ingroup Language
6 */
7 class LanguageBs extends Language {
8
9 /**
10 * @param $count int
11 * @param $forms array
12 * @return string
13 */
14 function convertPlural( $count, $forms ) {
15 if ( !count( $forms ) ) { return ''; }
16 $forms = $this->preConvertPlural( $forms, 3 );
17
18 // @todo FIXME: CLDR defines 4 plural forms instead of 3. Plural for decimals is missing.
19 // http://unicode.org/repos/cldr-tmp/trunk/diff/supplemental/language_plural_rules.html
20 if ( $count > 10 && floor( ( $count % 100 ) / 10 ) == 1 ) {
21 return $forms[2];
22 } else {
23 switch ( $count % 10 ) {
24 case 1: return $forms[0];
25 case 2:
26 case 3:
27 case 4: return $forms[1];
28 default: return $forms[2];
29 }
30 }
31 }
32
33 # Convert from the nominative form of a noun to some other case
34 # Invoked with {{GRAMMAR:case|word}}
35 /**
36 * Cases: genitiv, dativ, akuzativ, vokativ, instrumental, lokativ
37 */
38 function convertGrammar( $word, $case ) {
39 global $wgGrammarForms;
40 if ( isset( $wgGrammarForms['bs'][$case][$word] ) ) {
41 return $wgGrammarForms['bs'][$case][$word];
42 }
43 switch ( $case ) {
44 case 'instrumental': # instrumental
45 $word = 's ' . $word;
46 break;
47 case 'lokativ': # locative
48 $word = 'o ' . $word;
49 break;
50 }
51
52 return $word; # this will return the original value for 'nominativ' (nominative) and all undefined case values
53 }
54 }