* Typo and whitespace
[lhc/web/wiklou.git] / languages / LanguageTyv.php
1 <?php
2 /** Tyvan localization (Тыва дыл)
3 * @package MediaWiki
4 * @subpackage Language
5 */
6
7 # From friends at tyvawiki.org
8 # Originally based upon LanguageRu.php
9
10 require_once( 'LanguageUtf8.php' );
11
12 #--------------------------------------------------------------------------
13 # Language-specific text
14 #--------------------------------------------------------------------------
15
16 /* private */ $wgNamespaceNamesTyv = array(
17 NS_MEDIA => 'Медиа', //Media
18 NS_SPECIAL => 'Тускай', //Special
19 NS_MAIN => '',
20 NS_TALK => 'Чугаа', //Talk
21 NS_USER => 'Aжыглакчы', //User
22 NS_USER_TALK => 'Aжыглакчы_чугаа', //User_talk
23 NS_PROJECT => $wgMetaNamespace,
24 NS_PROJECT_TALK => $wgMetaNamespace . '_чугаа', //_talk
25 NS_IMAGE => 'Чурук', //Image
26 NS_IMAGE_TALK => 'Чурук_чугаа', //Image_talk
27 NS_MEDIAWIKI => 'МедиаВики', //MediaWiki
28 NS_MEDIAWIKI_TALK => 'МедиаВики_чугаа', //MediaWiki_talk
29 NS_TEMPLATE => 'Хээ', //Template
30 NS_TEMPLATE_TALK => 'Хээ_чугаа', //Template_talk
31 NS_HELP => 'Дуза', //Help
32 NS_HELP_TALK => 'Дуза_чугаа', //Help_talk
33 NS_CATEGORY => 'Бөлүк', //Category
34 NS_CATEGORY_TALK => 'Бөлүк_чугаа', //Category_talk
35 ) + $wgNamespaceNamesEn;
36
37 /* private */ $wgSkinNamesTyv = array(
38 'standard' => 'Classic', //Classic
39 'nostalgia' => 'Nostalgia', //Nostalgia
40 'cologneblue' => 'Cologne Blue', //Cologne Blue
41 'davinci' => 'ДаВинчи', //DaVinci
42 'mono' => 'Моно', //Mono
43 'monobook' => 'Моно-Ном', //MonoBook
44 'myskin' => 'MySkin', //MySkin
45 'chick' => 'Chick' //Chick
46 ) + $wgSkinNamesEn;
47
48 /* private */ $wgBookstoreListTyv = array(
49 'ОЗОН' => 'http://www.ozon.ru/?context=advsearch_book&isbn=$1',
50 'Books.Ru' => 'http://www.books.ru/shop/search/advanced?as%5Btype%5D=books&as%5Bname%5D=&as%5Bisbn%5D=$1&as%5Bauthor%5D=&as%5Bmaker%5D=&as%5Bcontents%5D=&as%5Binfo%5D=&as%5Bdate_after%5D=&as%5Bdate_before%5D=&as%5Bprice_less%5D=&as%5Bprice_more%5D=&as%5Bstrict%5D=%E4%E0&as%5Bsub%5D=%E8%F1%EA%E0%F2%FC&x=22&y=8',
51 'Яндекс.Маркет' => 'http://market.yandex.ru/search.xml?text=$1',
52 'Amazon.com' => 'http://www.amazon.com/exec/obidos/ISBN=$1',
53 'AddALL' => 'http://www.addall.com/New/Partner.cgi?query=$1&type=ISBN',
54 'PriceSCAN' => 'http://www.pricescan.com/books/bookDetail.asp?isbn=$1',
55 'Barnes & Noble' => 'http://shop.barnesandnoble.com/bookSearch/isbnInquiry.asp?isbn=$1'
56 );
57
58 if (!$wgCachedMessageArrays) {
59 require_once('MessagesTyv.php');
60 }
61
62
63 #--------------------------------------------------------------------------
64 # Internationalisation code
65 #--------------------------------------------------------------------------
66
67 class LanguageTyv extends LanguageUtf8 {
68 function LanguageTyv() {
69 global $wgNamespaceNamesTyv, $wgMetaNamespace;
70 LanguageUtf8::LanguageUtf8();
71 $wgNamespaceNamesTyv[NS_PROJECT_TALK] = $wgMetaNamespace . '_чугаа';
72 }
73
74 function getNamespaces() {
75 global $wgNamespaceNamesTyv;
76 return $wgNamespaceNamesTyv;
77 }
78
79 function getSkinNames() {
80 global $wgSkinNamesTyv;
81 return $wgSkinNamesTyv;
82 }
83
84 function getMessage( $key ) {
85 global $wgAllMessagesTyv;
86 return isset($wgAllMessagesTyv[$key]) ? $wgAllMessagesTyv[$key] : parent::getMessage($key);
87 }
88
89 function fallback8bitEncoding() {
90 return "windows-1251";
91 }
92
93 /**
94 * Grammatical transformations, needed for inflected languages
95 * Invoked by putting {{grammar:case|word}} in a message
96 *
97 * @param string $word
98 * @param string $case
99 * @return string
100 */
101 function convertGrammar( $word, $case ) {
102
103 // Set up some constants...
104 $allVowels = array("е", "и", "э", "ө", "ү", "а", "ё", "о", "у", "ы", "ю", "я", "a", "e", "i", "o", "ö", "u", "ü", "y");
105 $frontVowels = array("е", "и", "э", "ө", "ү", "e", "i", "ö", "ü");
106 $backVowels = array("а", "ё", "о", "у", "ы", "ю", "я", "a", "o", "u", "y");
107 $unroundFrontVowels = array("е", "и", "э", "e", "i");
108 $roundFrontVowels = array("ө", "ү", "ö", "ü");
109 $unroundBackVowels = array("а", "ы", "я", "a", "y");
110 $roundBackVowels = array("ё", "о", "у", "ю", "o", "u");
111 $voicedPhonemes = array("д", "б", "з", "ж", "г", "d", "b", "z", "g");
112 $unvoicedPhonemes = array("т", "п", "с", "ш", "к", "ч", "х", "t", "p", "s", "k", "x");
113 $directiveUnvoicedStems = array("т", "п", "с", "ш", "к", "ч", "х", "л", "м", "н", "ң", "t", "p", "s", "k", "x", "l", "m", "n", "ŋ");
114 $directiveVoicedStems = array("д", "б", "з", "ж", "г", "р", "й", "d", "b", "z", "g", "r", "j");
115
116 // $allSonants = array("л", "м", "н", "ң", "р", "й");
117 // $allNasals = array("м", "н", "ң");
118
119 // Put the word in a form we can play with since we're using UTF-8
120 preg_match_all( '/./us', $word, $ar );
121
122 $wordEnding = $ar[0][count($ar[0]) - 1]; //Here's the last letter in the word
123 $wordReversed = array_reverse($ar[0]); //Here's an array with the order of the letters in the word reversed so we can find a match quicker *shrug*
124
125 // Find the last vowel in the word
126 $wordLastVowel = NULL;
127 foreach ( $wordReversed as $xvalue ) {
128 foreach ( $allVowels as $yvalue ) {
129 if ( strcmp($xvalue, $yvalue) == 0 ) {
130 $wordLastVowel = $xvalue;
131 break;
132 } else {
133 continue;
134 }
135 }
136 if ( $wordLastVowel !== NULL ) {
137 break;
138 } else {
139 continue;
140 }
141 }
142
143 // Now convert the word
144 switch ( $case ) {
145 case "genitive":
146 if ( in_array($wordEnding, $unvoicedPhonemes) ) {
147 if ( in_array($wordLastVowel, $roundFrontVowels) ) {
148 $word = implode("",$ar[0]) . "түң";
149 } elseif ( in_array($wordLastVowel, $unroundFrontVowels) ) {
150 $word = implode("",$ar[0]) . "тиң";
151 } elseif ( in_array($wordLastVowel, $roundBackVowels) ) {
152 $word = implode("",$ar[0]) . "туң";
153 } elseif ( in_array($wordLastVowel, $unroundBackVowels) ) {
154 $word = implode("",$ar[0]) . "тың";
155 } else {
156 }
157 } elseif ( $wordEnding === "л" || $wordEnding === "l") {
158 if ( in_array($wordLastVowel, $roundFrontVowels) ) {
159 $word = implode("",$ar[0]) . "дүң";
160 } elseif ( in_array($wordLastVowel, $unroundFrontVowels) ) {
161 $word = implode("",$ar[0]) . "диң";
162 } elseif ( in_array($wordLastVowel, $roundBackVowels) ) {
163 $word = implode("",$ar[0]) . "дуң";
164 } elseif ( in_array($wordLastVowel, $unroundBackVowels) ) {
165 $word = implode("",$ar[0]) . "дың";
166 } else {
167 }
168 } else {
169 if ( in_array($wordLastVowel, $roundFrontVowels) ) {
170 $word = implode("",$ar[0]) . "нүң";
171 } elseif ( in_array($wordLastVowel, $unroundFrontVowels) ) {
172 $word = implode("",$ar[0]) . "ниң";
173 } elseif ( in_array($wordLastVowel, $roundBackVowels) ) {
174 $word = implode("",$ar[0]) . "нуң";
175 } elseif ( in_array($wordLastVowel, $unroundBackVowels) ) {
176 $word = implode("",$ar[0]) . "ның";
177 } else {
178 }
179 }
180 break;
181 case "dative":
182 if ( in_array($wordEnding, $unvoicedPhonemes) ) {
183 if ( in_array($wordLastVowel, $frontVowels) ) {
184 $word = implode("",$ar[0]) . "ке";
185 } elseif ( in_array($wordLastVowel, $backVowels) ) {
186 $word = implode("",$ar[0]) . "ка";
187 } else {
188 }
189 } else {
190 if ( in_array($wordLastVowel, $frontVowels) ) {
191 $word = implode("",$ar[0]) . "ге";
192 } elseif ( in_array($wordLastVowel, $backVowels) ) {
193 $word = implode("",$ar[0]) . "га";
194 } else {
195 }
196 }
197 break;
198 case "accusative":
199 if ( in_array($wordEnding, $unvoicedPhonemes) ) {
200 if ( in_array($wordLastVowel, $roundFrontVowels) ) {
201 $word = implode("",$ar[0]) . "тү";
202 } elseif ( in_array($wordLastVowel, $unroundFrontVowels) ) {
203 $word = implode("",$ar[0]) . "ти";
204 } elseif ( in_array($wordLastVowel, $roundBackVowels) ) {
205 $word = implode("",$ar[0]) . "ту";
206 } elseif ( in_array($wordLastVowel, $unroundBackVowels) ) {
207 $word = implode("",$ar[0]) . "ты";
208 } else {
209 }
210 } elseif ( $wordEnding === "л" || $wordEnding === "l") {
211 if ( in_array($wordLastVowel, $roundFrontVowels) ) {
212 $word = implode("",$ar[0]) . "дү";
213 } elseif ( in_array($wordLastVowel, $unroundFrontVowels) ) {
214 $word = implode("",$ar[0]) . "ди";
215 } elseif ( in_array($wordLastVowel, $roundBackVowels) ) {
216 $word = implode("",$ar[0]) . "ду";
217 } elseif ( in_array($wordLastVowel, $unroundBackVowels) ) {
218 $word = implode("",$ar[0]) . "ды";
219 } else {
220 }
221 } else {
222 if ( in_array($wordLastVowel, $roundFrontVowels) ) {
223 $word = implode("",$ar[0]) . "нү";
224 } elseif ( in_array($wordLastVowel, $unroundFrontVowels) ) {
225 $word = implode("",$ar[0]) . "ни";
226 } elseif ( in_array($wordLastVowel, $roundBackVowels) ) {
227 $word = implode("",$ar[0]) . "ну";
228 } elseif ( in_array($wordLastVowel, $unroundBackVowels) ) {
229 $word = implode("",$ar[0]) . "ны";
230 } else {
231 }
232 }
233 break;
234 case "locative":
235 if ( in_array($wordEnding, $unvoicedPhonemes) ) {
236 if ( in_array($wordLastVowel, $frontVowels) ) {
237 $word = implode("",$ar[0]) . "те";
238 } elseif ( in_array($wordLastVowel, $backVowels) ) {
239 $word = implode("",$ar[0]) . "та";
240 } else {
241 }
242 } else {
243 if ( in_array($wordLastVowel, $frontVowels) ) {
244 $word = implode("",$ar[0]) . "де";
245 } elseif ( in_array($wordLastVowel, $backVowels) ) {
246 $word = implode("",$ar[0]) . "да";
247 } else {
248 }
249 }
250 break;
251 case "ablative":
252 if ( in_array($wordEnding, $unvoicedPhonemes) ) {
253 if ( in_array($wordLastVowel, $frontVowels) ) {
254 $word = implode("",$ar[0]) . "тен";
255 } elseif ( in_array($wordLastVowel, $backVowels) ) {
256 $word = implode("",$ar[0]) . "тан";
257 } else {
258 }
259 } else {
260 if ( in_array($wordLastVowel, $frontVowels) ) {
261 $word = implode("",$ar[0]) . "ден";
262 } elseif ( in_array($wordLastVowel, $backVowels) ) {
263 $word = implode("",$ar[0]) . "дан";
264 } else {
265 }
266 }
267 break;
268 case "directive1":
269 if ( in_array($wordEnding, $directiveVoicedStems) ) {
270 $word = implode("",$ar[0]) . "же";
271 } elseif ( in_array($wordEnding, $directiveUnvoicedStems) ) {
272 $word = implode("",$ar[0]) . "че";
273 } else {
274 }
275 break;
276 case "directive2":
277 if ( in_array($wordEnding, $unvoicedPhonemes) ) {
278 if ( in_array($wordLastVowel, $roundFrontVowels) ) {
279 $word = implode("",$ar[0]) . "түве";
280 } elseif ( in_array($wordLastVowel, $unroundFrontVowels) ) {
281 $word = implode("",$ar[0]) . "тиве";
282 } elseif ( in_array($wordLastVowel, $roundBackVowels) ) {
283 $word = implode("",$ar[0]) . "туве";
284 } elseif ( in_array($wordLastVowel, $unroundBackVowels) ) {
285 $word = implode("",$ar[0]) . "тыве";
286 } else {
287 }
288 } else {
289 if ( in_array($wordLastVowel, $roundFrontVowels) ) {
290 $word = implode("",$ar[0]) . "дүве";
291 } elseif ( in_array($wordLastVowel, $unroundFrontVowels) ) {
292 $word = implode("",$ar[0]) . "диве";
293 } elseif ( in_array($wordLastVowel, $roundBackVowels) ) {
294 $word = implode("",$ar[0]) . "дуве";
295 } elseif ( in_array($wordLastVowel, $unroundBackVowels) ) {
296 $word = implode("",$ar[0]) . "дыве";
297 } else {
298 }
299 }
300 break;
301 default:
302 break;
303 }
304 return $word;
305 }
306 }
307 ?>