Got rid of about 20 regex calls in braceSubstitution() relating to function-like...
[lhc/web/wiklou.git] / languages / LanguageSl.php
1 <?php
2 /** Slovenian (Slovenščina)
3 *
4 * @package MediaWiki
5 * @subpackage Language
6 *
7 */
8
9 #
10 # Revision/
11 # Inačica 1.00.00 XJamRastafire 2003-07-08 |NOT COMPLETE
12 # 1.00.10 XJamRastafire 2003-11-03 |NOT COMPLETE
13 # ______________________________________________________
14 # 1.00.20 XJamRastafire 2003-11-05 | COMPLETE
15 # 1.00.30 romanm 2003-11-07 | minor changes
16 # 1.00.31 romanm 2003-11-11 | merged incorrectly broken lines
17 # 1.00.32 romanm 2003-11-19 | merged incorrectly broken lines
18 # 1.00.40 romanm 2003-11-21 | fixed Google search
19
20
21 require_once( 'LanguageUtf8.php' );
22
23 if (!$wgCachedMessageArrays) {
24 require_once('MessagesSl.php');
25 }
26
27 class LanguageSl extends LanguageUtf8 {
28 private $mMessagesSl, $mNamespaceNamesSl = null;
29
30 private $mQuickbarSettingsSl = array(
31 'Brez', 'Levo nepomično', 'Desno nepomično', 'Levo leteče'
32 );
33
34 private $mMonthNameGenSl = array(
35 'januarja', 'februarja', 'marca', 'aprila', 'maja', 'junija',
36 'julija', 'avgusta', 'septembra', 'oktobra', 'novembra', 'decembra'
37 );
38
39 function __construct() {
40 parent::__construct();
41
42 global $wgAllMessagesSl;
43 $this->mMessagesSl =& $wgAllMessagesSl;
44
45 global $wgMetaNamespace;
46 $this->mNamespaceNamesSl = array(
47 NS_MEDIA => 'Media',
48 NS_SPECIAL => 'Posebno',
49 NS_MAIN => '',
50 NS_TALK => 'Pogovor',
51 NS_USER => 'Uporabnik',
52 NS_USER_TALK => 'Uporabniški_pogovor',
53 NS_PROJECT => $wgMetaNamespace,
54 NS_PROJECT_TALK => 'Pogovor_' .
55 str_replace( ' ', '_', $this->convertGrammar( $wgMetaNamespace, 'mestnik' ) ),
56 NS_IMAGE => 'Slika',
57 NS_IMAGE_TALK => 'Pogovor_o_sliki',
58 NS_MEDIAWIKI => 'MediaWiki',
59 NS_MEDIAWIKI_TALK => 'Pogovor_o_MediaWiki',
60 NS_TEMPLATE => 'Predloga',
61 NS_TEMPLATE_TALK => 'Pogovor_o_predlogi',
62 NS_HELP => 'Pomoč',
63 NS_HELP_TALK => 'Pogovor_o_pomoči',
64 NS_CATEGORY => 'Kategorija',
65 NS_CATEGORY_TALK => 'Pogovor_o_kategoriji'
66 );
67
68 }
69
70 function getNamespaces() {
71 return $this->mNamespaceNamesSl + parent::getNamespaces();
72 }
73
74 function getQuickbarSettings() {
75 return $this->mQuickbarSettingsSl;
76 }
77
78 function getDateFormats() {
79 return false;
80 }
81
82 function getMessage( $key ) {
83 if( isset( $this->mMessagesSl[$key] ) ) {
84 return $this->mMessagesSl[$key];
85 } else {
86 return parent::getMessage( $key );
87 }
88 }
89
90 function getAllMessages() {
91 return $this->mMessagesSl;
92 }
93
94
95 function fallback8bitEncoding() {
96 return "iso-8859-2";
97 }
98
99 function separatorTransformTable() {
100 return array(',' => '.', '.' => ',' );
101 }
102
103 function getMonthNameGen( $key ) {
104 return $this->mMonthNameGenSl[$key-1];
105 }
106
107
108 # Convert from the nominative form of a noun to some other case
109 # Invoked with {{GRAMMAR:case|word}}
110 /**
111 * Cases: rodilnik, dajalnik, tožilnik, mestnik, orodnik
112 */
113 function convertGrammar( $word, $case ) {
114 global $wgGrammarForms;
115 if ( isset($wgGrammarForms['sl'][$case][$word]) ) {
116 return $wgGrammarForms['sl'][$case][$word];
117 }
118
119 switch ( $case ) {
120 case 'rodilnik': # genitive
121 if ( $word == 'Wikipedija' ) {
122 $word = 'Wikipedije';
123 } elseif ( $word == 'Wikiknjige' ) {
124 $word = 'Wikiknjig';
125 } elseif ( $word == 'Wikinovice' ) {
126 $word = 'Wikinovic';
127 } elseif ( $word == 'Wikinavedek' ) {
128 $word = 'Wikinavedka';
129 } elseif ( $word == 'Wikivir' ) {
130 $word = 'Wikivira';
131 } elseif ( $word == 'Wikislovar' ) {
132 $word = 'Wikislovarja';
133 }
134 break;
135 case 'dajalnik': # dativ
136 if ( $word == 'Wikipedija' ) {
137 $word = 'Wikipediji';
138 } elseif ( $word == 'Wikiknjige' ) {
139 $word = 'Wikiknjigam';
140 } elseif ( $word == 'Wikinovice' ) {
141 $word = 'Wikinovicam';
142 } elseif ( $word == 'Wikinavedek' ) {
143 $word = 'Wikinavedku';
144 } elseif ( $word == 'Wikivir' ) {
145 $word = 'Wikiviru';
146 } elseif ( $word == 'Wikislovar' ) {
147 $word = 'Wikislovarju';
148 }
149 break;
150 case 'tožilnik': # akuzatív
151 if ( $word == 'Wikipedija' ) {
152 $word = 'Wikipedijo';
153 } elseif ( $word == 'Wikiknjige' ) {
154 $word = 'Wikiknjige';
155 } elseif ( $word == 'Wikinovice' ) {
156 $word = 'Wikinovice';
157 } elseif ( $word == 'Wikinavedek' ) {
158 $word = 'Wikinavedek';
159 } elseif ( $word == 'Wikivir' ) {
160 $word = 'Wikivir';
161 } elseif ( $word == 'Wikislovar' ) {
162 $word = 'Wikislovar';
163 }
164 break;
165 case 'mestnik': # locative
166 if ( $word == 'Wikipedija' ) {
167 $word = 'o Wikipediji';
168 } elseif ( $word == 'Wikiknjige' ) {
169 $word = 'o Wikiknjigah';
170 } elseif ( $word == 'Wikinovice' ) {
171 $word = 'o Wikinovicah';
172 } elseif ( $word == 'Wikinavedek' ) {
173 $word = 'o Wikinavedku';
174 } elseif ( $word == 'Wikivir' ) {
175 $word = 'o Wikiviru';
176 } elseif ( $word == 'Wikislovar' ) {
177 $word = 'o Wikislovarju';
178 } else {
179 $word = 'o ' . $word;
180 }
181 break;
182 case 'orodnik': # instrumental
183 if ( $word == 'Wikipedija' ) {
184 $word = 'z Wikipedijo';
185 } elseif ( $word == 'Wikiknjige' ) {
186 $word = 'z Wikiknjigami';
187 } elseif ( $word == 'Wikinovice' ) {
188 $word = 'z Wikinovicami';
189 } elseif ( $word == 'Wikinavedek' ) {
190 $word = 'z Wikinavedkom';
191 } elseif ( $word == 'Wikivir' ) {
192 $word = 'z Wikivirom';
193 } elseif ( $word == 'Wikislovar' ) {
194 $word = 'z Wikislovarjem';
195 } else {
196 $word = 'z ' . $word;
197 }
198 break;
199 }
200
201 return $word; # this will return the original value for 'imenovalnik' (nominativ) and all undefined case values
202 }
203
204 function convertPlural( $count, $w1, $w2, $w3, $w4, $w5) {
205 $count = str_replace ('.', '', $count);
206 $forms = array( $w1, $w2, $w3, $w4, $w5 );
207 if ( $count % 100 == 1 ) {
208 $index = 0;
209 } elseif ( $count % 100 == 2 ) {
210 $index = 1;
211 } elseif ( $count % 100 == 3 || $count % 100 == 4 ) {
212 $index = 2;
213 } elseif ( $count != 0 ) {
214 $index = 3;
215 } else {
216 $index = 4;
217 }
218 return $forms[$index];
219 }
220
221
222 }
223 ?>