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