summaryrefslogtreecommitdiff
path: root/languages/classes/LanguageSl.php
blob: e8f9456761d7f424f949c8d15e6137dcfb3dfba9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
<?php
/** Slovenian (Slovenščina)
 *
 * @addtogroup Language
 *
 */
class LanguageSl extends Language {
	# Convert from the nominative form of a noun to some other case
	# Invoked with {{GRAMMAR:case|word}}
	/**
	 * Cases: rodilnik, dajalnik, tožilnik, mestnik, orodnik
	 */
	function convertGrammar( $word, $case ) {
		global $wgGrammarForms;
		if ( isset($wgGrammarForms['sl'][$case][$word]) ) {
			return $wgGrammarForms['sl'][$case][$word];
		}

		switch ( $case ) {
			case 'rodilnik': # genitive
				switch ( $word ) {
					case 'Wikipedija': $word = 'Wikipedije'; break 2;
					case 'Wikiknjige': $word = 'Wikiknjig'; break 2;
					case 'Wikinovice': $word = 'Wikinovic'; break 2;
					case 'Wikinavedek': $word = 'Wikinavedka'; break 2;
					case 'Wikivir': $word = 'Wikivira'; break 2;
					case 'Wikislovar': $word = 'Wikislovarja'; break 2;
				}
			case 'dajalnik': # dativ
				switch ( $word ) {
					case 'Wikipedija': $word = 'Wikipediji'; break 2;
					case 'Wikiknjige': $word = 'Wikiknjigam'; break 2;
					case 'Wikinovice': $word = 'Wikinovicam'; break 2;
					case 'Wikinavedek': $word = 'Wikinavedku'; break 2;
					case 'Wikivir': $word = 'Wikiviru'; break 2;
					case 'Wikislovar': $word = 'Wikislovarju'; break 2;
				}
			case 'tožilnik': # akuzatív
				switch ( $word ) {
					case 'Wikipedija': $word = 'Wikipedijo'; break 2;
					case 'Wikiknjige':
					case 'Wikinovice':
					case 'Wikinavedek':
					case 'Wikivir':
					case 'Wikislovar':
						// Don't change, just fall through
						break 2;
				}
			case 'mestnik': # locative
				switch ( $word ) {
					case 'Wikipedija': $word = 'o Wikipediji'; break 2;
					case 'Wikiknjige': $word = 'o Wikiknjigah'; break 2;
					case 'Wikinovice': $word = 'o Wikinovicah'; break 2;
					case 'Wikinavedek': $word = 'o Wikinavedku'; break 2;
					case 'Wikivir': $word = 'o Wikiviru'; break 2;
					case 'Wikislovar': $word = 'o Wikislovarju'; break 2;
					default: $word = 'o ' . $word; break 2;
				}
			case 'orodnik': # instrumental
				switch ( $word ) {
					case 'Wikipedija': $word = 'z Wikipedijo'; break 2;
					case 'Wikiknjige': $word = 'z Wikiknjigami'; break 2;
					case 'Wikinovice': $word = 'z Wikinovicami'; break 2;
					case 'Wikinavedek': $word = 'z Wikinavedkom'; break 2;
					case 'Wikivir': $word = 'z Wikivirom'; break 2;
					case 'Wikislovar': $word = 'z Wikislovarjem'; break 2;
					default: $word = 'z ' . $word;
				}
		}

		return $word; # this will return the original value for 'imenovalnik' (nominativ) and all undefined case values
	}

	function convertPlural( $count, $w1, $w2, $w3, $w4, $w5) {
		$count = str_replace ('.', '', $count);
		$forms = array( $w1, $w2, $w3, $w4, $w5 );
		if ( $count % 100 == 1 ) {
			$index = 0;
		} elseif ( $count % 100 == 2 ) {
			$index = 1;
		} elseif ( $count % 100 == 3 || $count % 100 == 4 ) {
			$index = 2;
		} elseif ( $count != 0 ) {
			$index = 3;
		} else {
			$index = 4;
		}
		return $forms[$index];
	}


}
?>