[FileBackend] Some documentation and minor cleanups.
[mediawiki.git] / languages / classes / LanguageBs.php
blob7c13037e57cc5630765cc04b10b91e2a8488a888
1 <?php
3 /** Bosnian (bosanski)
5 * @ingroup Language
6 */
7 class LanguageBs extends Language {
9 /**
10 * @param $count int
11 * @param $forms array
12 * @return string
14 function convertPlural( $count, $forms ) {
15 if ( !count( $forms ) ) { return ''; }
16 $forms = $this->preConvertPlural( $forms, 3 );
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];
33 /**
34 * Convert from the nominative form of a noun to some other case
35 * Invoked with {{GRAMMAR:case|word}}
37 * Cases: genitiv, dativ, akuzativ, vokativ, instrumental, lokativ
39 * @param $word string
40 * @param $case string
42 * @return string
44 function convertGrammar( $word, $case ) {
45 global $wgGrammarForms;
46 if ( isset( $wgGrammarForms['bs'][$case][$word] ) ) {
47 return $wgGrammarForms['bs'][$case][$word];
49 switch ( $case ) {
50 case 'instrumental': # instrumental
51 $word = 's ' . $word;
52 break;
53 case 'lokativ': # locative
54 $word = 'o ' . $word;
55 break;
58 return $word; # this will return the original value for 'nominativ' (nominative) and all undefined case values