mediawiki.special.preferences: Support Back/Forward navigation
[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 * @param $word string
14 * @param $case string
15 *
16 * @return string
17 */
18 function convertGrammar( $word, $case ) {
19 global $wgGrammarForms;
20 if ( isset( $wgGrammarForms['sl'][$case][$word] ) ) {
21 return $wgGrammarForms['sl'][$case][$word];
22 }
23
24 switch ( $case ) {
25 case 'mestnik': # locative
26 $word = 'o ' . $word; break;
27 case 'orodnik': # instrumental
28 $word = 'z ' . $word;
29 }
30
31 return $word; # this will return the original value for 'imenovalnik' (nominativ) and all undefined case values
32 }
33
34 /**
35 * @param $count int
36 * @param $forms array
37 *
38 * @return string
39 */
40 function convertPlural( $count, $forms ) {
41 if ( !count( $forms ) ) { return ''; }
42 $forms = $this->preConvertPlural( $forms, 5 );
43
44 if ( $count % 100 == 1 ) {
45 $index = 0;
46 } elseif ( $count % 100 == 2 ) {
47 $index = 1;
48 } elseif ( $count % 100 == 3 || $count % 100 == 4 ) {
49 $index = 2;
50 } elseif ( $count != 0 ) {
51 $index = 3;
52 } else {
53 $index = 4;
54 }
55 return $forms[$index];
56 }
57 }