mediawiki.special.preferences: Support Back/Forward navigation
[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 /**
34 * Convert from the nominative form of a noun to some other case
35 * Invoked with {{GRAMMAR:case|word}}
36 *
37 * Cases: genitiv, dativ, akuzativ, vokativ, instrumental, lokativ
38 *
39 * @param $word string
40 * @param $case string
41 *
42 * @return string
43 */
44 function convertGrammar( $word, $case ) {
45 global $wgGrammarForms;
46 if ( isset( $wgGrammarForms['bs'][$case][$word] ) ) {
47 return $wgGrammarForms['bs'][$case][$word];
48 }
49 switch ( $case ) {
50 case 'instrumental': # instrumental
51 $word = 's ' . $word;
52 break;
53 case 'lokativ': # locative
54 $word = 'o ' . $word;
55 break;
56 }
57
58 return $word; # this will return the original value for 'nominativ' (nominative) and all undefined case values
59 }
60 }