66477bb331cd2b3b3e9366034e52e8e59299cd0f
[lhc/web/wiklou.git] / languages / classes / LanguageSl.php
1 <?php
2
3 /** Slovenian (Slovenščina)
4 *
5 * @ingroup Language
6 */
7 class LanguageSl extends Language {
8 # Convert from the nominative form of a noun to some other case
9 # Invoked with {{GRAMMAR:case|word}}
10 /**
11 * Cases: rodilnik, dajalnik, tožilnik, mestnik, orodnik
12 */
13 function convertGrammar( $word, $case ) {
14 global $wgGrammarForms;
15 if ( isset( $wgGrammarForms['sl'][$case][$word] ) ) {
16 return $wgGrammarForms['sl'][$case][$word];
17 }
18
19 switch ( $case ) {
20 case 'mestnik': # locative
21 $word = 'o ' . $word; break;
22 case 'orodnik': # instrumental
23 $word = 'z ' . $word;
24 }
25
26 return $word; # this will return the original value for 'imenovalnik' (nominativ) and all undefined case values
27 }
28
29 /**
30 * @param $count int
31 * @param $forms array
32 *
33 * @return string
34 */
35 function convertPlural( $count, $forms ) {
36 if ( !count( $forms ) ) { return ''; }
37 $forms = $this->preConvertPlural( $forms, 5 );
38
39 if ( $count % 100 == 1 ) {
40 $index = 0;
41 } elseif ( $count % 100 == 2 ) {
42 $index = 1;
43 } elseif ( $count % 100 == 3 || $count % 100 == 4 ) {
44 $index = 2;
45 } elseif ( $count != 0 ) {
46 $index = 3;
47 } else {
48 $index = 4;
49 }
50 return $forms[$index];
51 }
52 }