Added translations for the remaining EXIF messages.
[lhc/web/wiklou.git] / languages / classes / LanguageKk_cyrl.php
1 <?php
2 /** Kazakh (Қазақша)
3 *
4 *
5 * @addtogroup Language
6 */
7
8
9 class LanguageKk_cyrl extends Language {
10
11 # Convert from the nominative form of a noun to some other case
12 # Invoked with {{GRAMMAR:case|word}}
13 /**
14 * Cases: genitive, dative, accusative, locative, ablative, comitative + possessive forms
15 */
16 function convertGrammar( $word, $case, $variant ) {
17 global $wgGrammarForms;
18
19 if ($variant='kk-cyrl') { $word = self::convertGrammarKk_cyrl( $word, $case ); }
20 if ($variant='kk-latn') { $word = self::convertGrammarKk_latn( $word, $case ); }
21 if ($variant='kk-arab') { $word = self::convertGrammarKk_arab( $word, $case ); }
22 return $word;
23 }
24
25 function convertGrammarKk_cyrl( $word, $case ) {
26 global $wgGrammarForms;
27 if ( isset( $wgGrammarForms['kk-kz'][$case][$word] ) ) {
28 return $wgGrammarForms['kk-kz'][$case][$word];
29 }
30 if ( isset( $wgGrammarForms['kk-cyrl'][$case][$word] ) ) {
31 return $wgGrammarForms['kk-cyrl'][$case][$word];
32 }
33 // Set up some constants...
34 // Vowels in last syllable
35 $frontVowels = array( "е", "ө", "ү", "і", "ә", "э", "я", "ё", "и" );
36 $backVowels = array( "а", "о", "ұ", "ы" );
37 $allVowels = array( "е", "ө", "ү", "і", "ә", "э", "а", "о", "ұ", "ы", "я", "ё", "и" );
38 // Preceding letters
39 $Nasals = array( "м", "н", "ң" );
40 $Sonants = array( "и", "й", "л", "р", "у", "ю");
41 $Consonants = array( "п", "ф", "к", "қ", "т", "ш", "с", "х", "ц", "ч", "щ", "б", "в", "г", "д" );
42 $Sibilants = array( "ж", "з" );
43 $Sonorants = array( "и", "й", "л", "р", "у", "ю", "м", "н", "ң", "ж", "з");
44
45 // Possessives
46 $firstPerson = array( "м", "ң" ); // 1st singular, 2nd unformal
47 $secondPerson = array( "з" ); // 1st plural, 2nd formal
48 $thirdPerson = array( "ы", "і" ); // 3rd
49
50 $lastLetter = self::lastLetter( $word, $allVowels );
51 $wordEnding =& $lastLetter[0];
52 $wordLastVowel =& $lastLetter[1];
53
54 // Now convert the word
55 switch ( $case ) {
56 case "dc1":
57 case "genitive": #ilik
58 if ( in_array( $wordEnding, $Consonants ) ) {
59 if ( in_array( $wordLastVowel, $frontVowels ) ) {
60 $word = $word . "тің";
61 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
62 $word = $word . "тың";
63 }
64 } elseif ( in_array( $wordEnding, $allVowels ) || in_array( $wordEnding, $Nasals ) ) {
65 if ( in_array( $wordLastVowel, $frontVowels ) ) {
66 $word = $word . "нің";
67 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
68 $word = $word . "ның";
69 }
70 } elseif ( in_array( $wordEnding, $Sonants ) || in_array( $wordEnding, $Sibilants )) {
71 if ( in_array( $wordLastVowel, $frontVowels ) ) {
72 $word = $word . "дің";
73 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
74 $word = $word . "дың";
75 }
76 }
77 break;
78 case "dc2":
79 case "dative": #barıs
80 if ( in_array( $wordEnding, $Consonants ) ) {
81 if ( in_array( $wordLastVowel, $frontVowels ) ) {
82 $word = $word . "ке";
83 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
84 $word = $word . "қа";
85 }
86 } elseif ( in_array( $wordEnding, $allVowels ) || in_array( $wordEnding, $Sonorants ) ) {
87 if ( in_array( $wordLastVowel, $frontVowels ) ) {
88 $word = $word . "ге";
89 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
90 $word = $word . "ға";
91 }
92 }
93 break;
94 case "dc21":
95 case "possessive dative": #täweldık + barıs
96 if ( in_array( $wordEnding, $firstPerson ) ) {
97 if ( in_array( $wordLastVowel, $frontVowels ) ) {
98 $word = $word . "е";
99 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
100 $word = $word . "а";
101 }
102 } elseif ( in_array( $wordEnding, $secondPerson ) ) {
103 if ( in_array( $wordLastVowel, $frontVowels ) ) {
104 $word = $word . "ге";
105 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
106 $word = $word . "ға";
107 }
108 } elseif ( in_array( $wordEnding, $thirdPerson ) ) {
109 if ( in_array( $wordLastVowel, $frontVowels ) ) {
110 $word = $word . "не";
111 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
112 $word = $word . "на";
113 }
114 }
115 break;
116 case "dc3":
117 case "accusative": #tabıs
118 if ( in_array( $wordEnding, $Consonants ) ) {
119 if ( in_array( $wordLastVowel, $frontVowels ) ) {
120 $word = $word . "ті";
121 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
122 $word = $word . "ты";
123 }
124 } elseif ( in_array( $wordEnding, $allVowels ) ) {
125 if ( in_array($wordLastVowel, $frontVowels ) ) {
126 $word = $word . "ні";
127 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
128 $word = $word . "ны";
129 }
130 } elseif ( in_array( $wordEnding, $Sonorants) ) {
131 if ( in_array( $wordLastVowel, $frontVowels) ) {
132 $word = $word . "ді";
133 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
134 $word = $word . "ды";
135 }
136 }
137 break;
138 case "dc31":
139 case "possessive accusative": #täweldık + tabıs
140 if ( in_array( $wordEnding, $firstPerson ) || in_array( $wordEnding, $secondPerson ) ) {
141 if ( in_array( $wordLastVowel, $frontVowels ) ) {
142 $word = $word . "ді";
143 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
144 $word = $word . "ды";
145 }
146 } elseif ( in_array( $wordEnding, $thirdPerson ) ) {
147 $word = $word . "н";
148 }
149 break;
150 case "dc4":
151 case "locative": #jatıs
152 if ( in_array( $wordEnding, $Consonants ) ) {
153 if ( in_array( $wordLastVowel, $frontVowels ) ) {
154 $word = $word . "те";
155 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
156 $word = $word . "та";
157 }
158 } elseif ( in_array( $wordEnding, $allVowels ) || in_array( $wordEnding, $Sonorants ) ) {
159 if ( in_array( $wordLastVowel, $frontVowels) ) {
160 $word = $word . "де";
161 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
162 $word = $word . "да";
163 }
164 }
165 break;
166 case "dc41":
167 case "possessive locative": #täweldık + jatıs
168 if ( in_array( $wordEnding, $firstPerson ) || in_array( $wordEnding, $secondPerson ) ) {
169 if ( in_array( $wordLastVowel, $frontVowels ) ) {
170 $word = $word . "де";
171 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
172 $word = $word . "да";
173 }
174 } elseif ( in_array( $wordEnding, $thirdPerson ) ) {
175 if ( in_array( $wordLastVowel, $frontVowels) ) {
176 $word = $word . "нде";
177 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
178 $word = $word . "нда";
179 }
180 }
181 break;
182 case "dc5":
183 case "ablative": #şığıs
184 if ( in_array( $wordEnding, $Consonants ) ) {
185 if ( in_array( $wordLastVowel, $frontVowels ) ) {
186 $word = $word . "тен";
187 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
188 $word = $word . "тан";
189 }
190 } elseif ( in_array($wordEnding, $allVowels ) || in_array($wordEnding, $Sonants ) || in_array($wordEnding, $Sibilants ) ) {
191 if ( in_array( $wordLastVowel, $frontVowels ) ) {
192 $word = $word . "ден";
193 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
194 $word = $word . "дан";
195 }
196 } elseif ( in_array($wordEnding, $Nasals ) ) {
197 if ( in_array( $wordLastVowel, $frontVowels ) ) {
198 $word = $word . "нен";
199 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
200 $word = $word . "нан";
201 }
202 }
203 break;
204 case "dc51":
205 case "possessive ablative": #täweldık + şığıs
206 if ( in_array( $wordEnding, $firstPerson ) || in_array( $wordEnding, $thirdPerson ) ) {
207 if ( in_array( $wordLastVowel, $frontVowels ) ) {
208 $word = $word . "нен";
209 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
210 $word = $word . "нан";
211 }
212 } elseif ( in_array($wordEnding, $secondPerson ) ) {
213 if ( in_array( $wordLastVowel, $frontVowels ) ) {
214 $word = $word . "ден";
215 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
216 $word = $word . "дан";
217 }
218 }
219 break;
220 case "dc6":
221 case "comitative": #kömektes
222 if ( in_array( $wordEnding, $Consonants ) ) {
223 $word = $word . "пен";
224 } elseif ( in_array( $wordEnding, $allVowels ) || in_array( $wordEnding, $Nasals ) || in_array( $wordEnding, $Sonants ) ) {
225 $word = $word . "мен";
226 } elseif ( in_array( $wordEnding, $Sibilants ) ) {
227 $word = $word . "бен";
228 }
229 break;
230 case "dc61":
231 case "possessive comitative": #täweldık + kömektes
232 if ( in_array( $wordEnding, $Consonants ) ) {
233 $word = $word . "пенен";
234 } elseif ( in_array( $wordEnding, $allVowels ) || in_array( $wordEnding, $Nasals ) || in_array( $wordEnding, $Sonants ) ) {
235 $word = $word . "менен";
236 } elseif ( in_array( $wordEnding, $Sibilants ) ) {
237 $word = $word . "бенен";
238 }
239 break;
240 default: #dc0 #nominative #ataw
241 }
242 return $word;
243 }
244
245 function convertGrammarKk_latn( $word, $case ) {
246 global $wgGrammarForms;
247 if ( isset( $wgGrammarForms['kk-tr'][$case][$word] ) ) {
248 return $wgGrammarForms['kk-tr'][$case][$word];
249 }
250 if ( isset( $wgGrammarForms['kk-latn'][$case][$word] ) ) {
251 return $wgGrammarForms['kk-latn'][$case][$word];
252 }
253 // Set up some constants...
254 // Vowels in last syllable
255 $frontVowels = array( "e", "ö", "ü", "i", "ä", "é" );
256 $backVowels = array( "a", "o", "u", "ı" );
257 $allVowels = array( "e", "ö", "ü", "i", "ä", "é", "a", "o", "u", "ı" );
258 // Preceding letters
259 $Nasals = array( "m", "n", "ñ" );
260 $Sonants = array( "ï", "y", "ý", "l", "r", "w");
261 $Consonants = array( "p", "f", "k", "q", "t", "ş", "s", "x", "c", "ç", "b", "v", "g", "d" );
262 $Sibilants = array( "j", "z" );
263 $Sonorants = array( "ï", "y", "ý", "l", "r", "w", "m", "n", "ñ", "j", "z");
264
265 // Possessives
266 $firstPerson = array( "m", "ñ" ); // 1st singular, 2nd unformal
267 $secondPerson = array( "z" ); // 1st plural, 2nd formal
268 $thirdPerson = array( "ı", "i" ); // 3rd
269
270 $lastLetter = self::lastLetter( $word, $allVowels );
271 $wordEnding =& $lastLetter[0];
272 $wordLastVowel =& $lastLetter[1];
273
274 // Now convert the word
275 switch ( $case ) {
276 case "dc1":
277 case "genitive": #ilik
278 if ( in_array( $wordEnding, $Consonants ) ) {
279 if ( in_array( $wordLastVowel, $frontVowels ) ) {
280 $word = $word . "tiñ";
281 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
282 $word = $word . "tıñ";
283 }
284 } elseif ( in_array( $wordEnding, $allVowels ) || in_array( $wordEnding, $Nasals ) ) {
285 if ( in_array( $wordLastVowel, $frontVowels ) ) {
286 $word = $word . "niñ";
287 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
288 $word = $word . "nıñ";
289 }
290 } elseif ( in_array( $wordEnding, $Sonants ) || in_array( $wordEnding, $Sibilants )) {
291 if ( in_array( $wordLastVowel, $frontVowels ) ) {
292 $word = $word . "diñ";
293 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
294 $word = $word . "dıñ";
295 }
296 }
297 break;
298 case "dc2":
299 case "dative": #barıs
300 if ( in_array( $wordEnding, $Consonants ) ) {
301 if ( in_array( $wordLastVowel, $frontVowels ) ) {
302 $word = $word . "ke";
303 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
304 $word = $word . "qa";
305 }
306 } elseif ( in_array( $wordEnding, $allVowels ) || in_array( $wordEnding, $Sonorants ) ) {
307 if ( in_array( $wordLastVowel, $frontVowels ) ) {
308 $word = $word . "ge";
309 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
310 $word = $word . "ğa";
311 }
312 }
313 break;
314 case "dc21":
315 case "possessive dative": #täweldık + barıs
316 if ( in_array( $wordEnding, $firstPerson ) ) {
317 if ( in_array( $wordLastVowel, $frontVowels ) ) {
318 $word = $word . "e";
319 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
320 $word = $word . "a";
321 }
322 } elseif ( in_array( $wordEnding, $secondPerson ) ) {
323 if ( in_array( $wordLastVowel, $frontVowels ) ) {
324 $word = $word . "ge";
325 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
326 $word = $word . "ğa";
327 }
328 } elseif ( in_array( $wordEnding, $thirdPerson ) ) {
329 if ( in_array( $wordLastVowel, $frontVowels ) ) {
330 $word = $word . "ne";
331 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
332 $word = $word . "na";
333 }
334 }
335 break;
336 case "dc3":
337 case "accusative": #tabıs
338 if ( in_array( $wordEnding, $Consonants ) ) {
339 if ( in_array( $wordLastVowel, $frontVowels ) ) {
340 $word = $word . "ti";
341 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
342 $word = $word . "tı";
343 }
344 } elseif ( in_array( $wordEnding, $allVowels ) ) {
345 if ( in_array($wordLastVowel, $frontVowels ) ) {
346 $word = $word . "ni";
347 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
348 $word = $word . "nı";
349 }
350 } elseif ( in_array( $wordEnding, $Sonorants) ) {
351 if ( in_array( $wordLastVowel, $frontVowels) ) {
352 $word = $word . "di";
353 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
354 $word = $word . "dı";
355 }
356 }
357 break;
358 case "dc31":
359 case "possessive accusative": #täweldık + tabıs
360 if ( in_array( $wordEnding, $firstPerson ) || in_array( $wordEnding, $secondPerson ) ) {
361 if ( in_array( $wordLastVowel, $frontVowels ) ) {
362 $word = $word . "di";
363 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
364 $word = $word . "dı";
365 }
366 } elseif ( in_array( $wordEnding, $thirdPerson ) ) {
367 $word = $word . "n";
368 }
369 break;
370 case "dc4":
371 case "locative": #jatıs
372 if ( in_array( $wordEnding, $Consonants ) ) {
373 if ( in_array( $wordLastVowel, $frontVowels ) ) {
374 $word = $word . "te";
375 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
376 $word = $word . "ta";
377 }
378 } elseif ( in_array( $wordEnding, $allVowels ) || in_array( $wordEnding, $Sonorants ) ) {
379 if ( in_array( $wordLastVowel, $frontVowels) ) {
380 $word = $word . "de";
381 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
382 $word = $word . "da";
383 }
384 }
385 break;
386 case "dc41":
387 case "possessive locative": #täweldık + jatıs
388 if ( in_array( $wordEnding, $firstPerson ) || in_array( $wordEnding, $secondPerson ) ) {
389 if ( in_array( $wordLastVowel, $frontVowels ) ) {
390 $word = $word . "de";
391 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
392 $word = $word . "da";
393 }
394 } elseif ( in_array( $wordEnding, $thirdPerson ) ) {
395 if ( in_array( $wordLastVowel, $frontVowels) ) {
396 $word = $word . "nde";
397 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
398 $word = $word . "nda";
399 }
400 }
401 break;
402 case "dc5":
403 case "ablative": #şığıs
404 if ( in_array( $wordEnding, $Consonants ) ) {
405 if ( in_array( $wordLastVowel, $frontVowels ) ) {
406 $word = $word . "ten";
407 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
408 $word = $word . "tan";
409 }
410 } elseif ( in_array($wordEnding, $allVowels ) || in_array($wordEnding, $Sonants ) || in_array($wordEnding, $Sibilants ) ) {
411 if ( in_array( $wordLastVowel, $frontVowels ) ) {
412 $word = $word . "den";
413 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
414 $word = $word . "dan";
415 }
416 } elseif ( in_array($wordEnding, $Nasals ) ) {
417 if ( in_array( $wordLastVowel, $frontVowels ) ) {
418 $word = $word . "nen";
419 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
420 $word = $word . "nan";
421 }
422 }
423 break;
424 case "dc51":
425 case "possessive ablative": #täweldık + şığıs
426 if ( in_array( $wordEnding, $firstPerson ) || in_array( $wordEnding, $thirdPerson ) ) {
427 if ( in_array( $wordLastVowel, $frontVowels ) ) {
428 $word = $word . "nen";
429 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
430 $word = $word . "nan";
431 }
432 } elseif ( in_array($wordEnding, $secondPerson ) ) {
433 if ( in_array( $wordLastVowel, $frontVowels ) ) {
434 $word = $word . "den";
435 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
436 $word = $word . "dan";
437 }
438 }
439 break;
440 case "dc6":
441 case "comitative": #kömektes
442 if ( in_array( $wordEnding, $Consonants ) ) {
443 $word = $word . "pen";
444 } elseif ( in_array( $wordEnding, $allVowels ) || in_array( $wordEnding, $Nasals ) || in_array( $wordEnding, $Sonants ) ) {
445 $word = $word . "men";
446 } elseif ( in_array( $wordEnding, $Sibilants ) ) {
447 $word = $word . "ben";
448 }
449 break;
450 case "dc61":
451 case "possessive comitative": #täweldık + kömektes
452 if ( in_array( $wordEnding, $Consonants ) ) {
453 $word = $word . "penen";
454 } elseif ( in_array( $wordEnding, $allVowels ) || in_array( $wordEnding, $Nasals ) || in_array( $wordEnding, $Sonants ) ) {
455 $word = $word . "menen";
456 } elseif ( in_array( $wordEnding, $Sibilants ) ) {
457 $word = $word . "benen";
458 }
459 break;
460 default: #dc0 #nominative #ataw
461 }
462 return $word;
463 }
464
465 function convertGrammarKk_arab( $word, $case ) {
466 global $wgGrammarForms;
467 if ( isset( $wgGrammarForms['kk-cn'][$case][$word] ) ) {
468 return $wgGrammarForms['kk-cn'][$case][$word];
469 }
470 if ( isset( $wgGrammarForms['kk-arab'][$case][$word] ) ) {
471 return $wgGrammarForms['kk-arab'][$case][$word];
472 }
473 // Set up some constants...
474 // Vowels in last syllable
475 $frontVowels = array( "ە", "ٶ", "ٷ", "ٸ", "ٵ", "ە" );
476 $backVowels = array( "ا", "و", "ۇ", "ى" );
477 $allVowels = array( "ە", "ٶ", "ٷ", "ٸ", "ٵ", "ە", "ا", "و", "ۇ", "ى" );
478 // Preceding letters
479 $Nasals = array( "م", "ن", "ڭ" );
480 $Sonants = array( "ي", "ي", "ل", "ر", "ۋ");
481 $Consonants = array( "پ", "ف", "ك", "ق", "ت", "ش", "س", "ح", "تس", "چ", "ب", "ۆ", "گ", "د" );
482 $Sibilants = array( "ج", "ز" );
483 $Sonorants = array( "ي", "ي", "ل", "ر", "ۋ", "م", "ن", "ڭ", "ج", "ز");
484
485 // Possessives
486 $firstPerson = array( "م", "ڭ" ); // 1st singular, 2nd unformal
487 $secondPerson = array( "ز" ); // 1st plural, 2nd formal
488 $thirdPerson = array( "ى", "ٸ" ); // 3rd
489
490 $lastLetter = self::lastLetter( $word, $allVowels );
491 $wordEnding =& $lastLetter[0];
492 $wordLastVowel =& $lastLetter[1];
493
494 // Now convert the word
495 switch ( $case ) {
496 case "dc1":
497 case "genitive": #ilik
498 if ( in_array( $wordEnding, $Consonants ) ) {
499 if ( in_array( $wordLastVowel, $frontVowels ) ) {
500 $word = $word . "تٸڭ";
501 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
502 $word = $word . "تىڭ";
503 }
504 } elseif ( in_array( $wordEnding, $allVowels ) || in_array( $wordEnding, $Nasals ) ) {
505 if ( in_array( $wordLastVowel, $frontVowels ) ) {
506 $word = $word . "نٸڭ";
507 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
508 $word = $word . "نىڭ";
509 }
510 } elseif ( in_array( $wordEnding, $Sonants ) || in_array( $wordEnding, $Sibilants )) {
511 if ( in_array( $wordLastVowel, $frontVowels ) ) {
512 $word = $word . "دٸڭ";
513 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
514 $word = $word . "دىڭ";
515 }
516 }
517 break;
518 case "dc2":
519 case "dative": #barıs
520 if ( in_array( $wordEnding, $Consonants ) ) {
521 if ( in_array( $wordLastVowel, $frontVowels ) ) {
522 $word = $word . "كە";
523 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
524 $word = $word . "قا";
525 }
526 } elseif ( in_array( $wordEnding, $allVowels ) || in_array( $wordEnding, $Sonorants ) ) {
527 if ( in_array( $wordLastVowel, $frontVowels ) ) {
528 $word = $word . "گە";
529 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
530 $word = $word . "عا";
531 }
532 }
533 break;
534 case "dc21":
535 case "possessive dative": #täweldık + barıs
536 if ( in_array( $wordEnding, $firstPerson ) ) {
537 if ( in_array( $wordLastVowel, $frontVowels ) ) {
538 $word = $word . "ە";
539 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
540 $word = $word . "ا";
541 }
542 } elseif ( in_array( $wordEnding, $secondPerson ) ) {
543 if ( in_array( $wordLastVowel, $frontVowels ) ) {
544 $word = $word . "گە";
545 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
546 $word = $word . "عا";
547 }
548 } elseif ( in_array( $wordEnding, $thirdPerson ) ) {
549 if ( in_array( $wordLastVowel, $frontVowels ) ) {
550 $word = $word . "نە";
551 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
552 $word = $word . "نا";
553 }
554 }
555 break;
556 case "dc3":
557 case "accusative": #tabıs
558 if ( in_array( $wordEnding, $Consonants ) ) {
559 if ( in_array( $wordLastVowel, $frontVowels ) ) {
560 $word = $word . "تٸ";
561 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
562 $word = $word . "تى";
563 }
564 } elseif ( in_array( $wordEnding, $allVowels ) ) {
565 if ( in_array($wordLastVowel, $frontVowels ) ) {
566 $word = $word . "نٸ";
567 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
568 $word = $word . "نى";
569 }
570 } elseif ( in_array( $wordEnding, $Sonorants) ) {
571 if ( in_array( $wordLastVowel, $frontVowels) ) {
572 $word = $word . "دٸ";
573 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
574 $word = $word . "دى";
575 }
576 }
577 break;
578 case "dc31":
579 case "possessive accusative": #täweldık + tabıs
580 if ( in_array( $wordEnding, $firstPerson ) || in_array( $wordEnding, $secondPerson ) ) {
581 if ( in_array( $wordLastVowel, $frontVowels ) ) {
582 $word = $word . "دٸ";
583 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
584 $word = $word . "دى";
585 }
586 } elseif ( in_array( $wordEnding, $thirdPerson ) ) {
587 $word = $word . "ن";
588 }
589 break;
590 case "dc4":
591 case "locative": #jatıs
592 if ( in_array( $wordEnding, $Consonants ) ) {
593 if ( in_array( $wordLastVowel, $frontVowels ) ) {
594 $word = $word . "تە";
595 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
596 $word = $word . "تا";
597 }
598 } elseif ( in_array( $wordEnding, $allVowels ) || in_array( $wordEnding, $Sonorants ) ) {
599 if ( in_array( $wordLastVowel, $frontVowels) ) {
600 $word = $word . "دە";
601 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
602 $word = $word . "دا";
603 }
604 }
605 break;
606 case "dc41":
607 case "possessive locative": #täweldık + jatıs
608 if ( in_array( $wordEnding, $firstPerson ) || in_array( $wordEnding, $secondPerson ) ) {
609 if ( in_array( $wordLastVowel, $frontVowels ) ) {
610 $word = $word . "دە";
611 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
612 $word = $word . "دا";
613 }
614 } elseif ( in_array( $wordEnding, $thirdPerson ) ) {
615 if ( in_array( $wordLastVowel, $frontVowels) ) {
616 $word = $word . "ندە";
617 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
618 $word = $word . "ندا";
619 }
620 }
621 break;
622 case "dc5":
623 case "ablative": #şığıs
624 if ( in_array( $wordEnding, $Consonants ) ) {
625 if ( in_array( $wordLastVowel, $frontVowels ) ) {
626 $word = $word . "تەن";
627 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
628 $word = $word . "تان";
629 }
630 } elseif ( in_array($wordEnding, $allVowels ) || in_array($wordEnding, $Sonants ) || in_array($wordEnding, $Sibilants ) ) {
631 if ( in_array( $wordLastVowel, $frontVowels ) ) {
632 $word = $word . "دەن";
633 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
634 $word = $word . "دان";
635 }
636 } elseif ( in_array($wordEnding, $Nasals ) ) {
637 if ( in_array( $wordLastVowel, $frontVowels ) ) {
638 $word = $word . "نەن";
639 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
640 $word = $word . "نان";
641 }
642 }
643 break;
644 case "dc51":
645 case "possessive ablative": #täweldık + şığıs
646 if ( in_array( $wordEnding, $firstPerson ) || in_array( $wordEnding, $thirdPerson ) ) {
647 if ( in_array( $wordLastVowel, $frontVowels ) ) {
648 $word = $word . "نەن";
649 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
650 $word = $word . "نان";
651 }
652 } elseif ( in_array($wordEnding, $secondPerson ) ) {
653 if ( in_array( $wordLastVowel, $frontVowels ) ) {
654 $word = $word . "دەن";
655 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
656 $word = $word . "دان";
657 }
658 }
659 break;
660 case "dc6":
661 case "comitative": #kömektes
662 if ( in_array( $wordEnding, $Consonants ) ) {
663 $word = $word . "پەن";
664 } elseif ( in_array( $wordEnding, $allVowels ) || in_array( $wordEnding, $Nasals ) || in_array( $wordEnding, $Sonants ) ) {
665 $word = $word . "مەن";
666 } elseif ( in_array( $wordEnding, $Sibilants ) ) {
667 $word = $word . "بەن";
668 }
669 break;
670 case "dc61":
671 case "possessive comitative": #täweldık + kömektes
672 if ( in_array( $wordEnding, $Consonants ) ) {
673 $word = $word . "پەنەن";
674 } elseif ( in_array( $wordEnding, $allVowels ) || in_array( $wordEnding, $Nasals ) || in_array( $wordEnding, $Sonants ) ) {
675 $word = $word . "مەنەن";
676 } elseif ( in_array( $wordEnding, $Sibilants ) ) {
677 $word = $word . "بەنەن";
678 }
679 break;
680 default: #dc0 #nominative #ataw
681 }
682 return $word;
683 }
684
685 function lastLetter( $word, $allVowels ) {
686 $lastLetter = array();
687 $ar = array();
688
689 // Put the word in a form we can play with since we're using UTF-8
690 $ar = preg_split('//u', parent::lc($word), -1, PREG_SPLIT_NO_EMPTY);
691
692 // Here's an array with the order of the letters in the word reversed
693 // so we can find a match quicker *shrug*
694 $wordReversed = array_reverse( $ar );
695
696 // Here's the last letter in the word
697 $lastLetter[0] = $ar[count( $ar ) - 1];
698
699 // Find the last vowel in the word
700 $lastLetter[1] = NULL;
701 foreach ( $wordReversed as $xvalue ) {
702 foreach ( $allVowels as $yvalue ) {
703 if ( strcmp( $xvalue, $yvalue ) == 0 ) {
704 $lastLetter[1] = $xvalue;
705 break;
706 } else {
707 continue;
708 }
709 }
710 if ( $lastLetter[1] !== NULL ) {
711 break;
712 } else {
713 continue;
714 }
715 }
716
717 return $lastLetter;
718 }
719
720 /**
721 * Avoid grouping whole numbers between 0 to 9999
722 */
723 function commafy( $_ ) {
724 if ( !preg_match( '/^\d{1,4}$/', $_ ) ) {
725 return strrev( (string)preg_replace( '/(\d{3})(?=\d)(?!\d*\.)/', '$1,', strrev($_) ) );
726 } else {
727 return $_;
728 }
729 }
730 }