9 class LanguageKk_cyrl
extends Language
{
11 # Convert from the nominative form of a noun to some other case
12 # Invoked with {{GRAMMAR:case|word}}
14 * Cases: genitive, dative, accusative, locative, ablative, comitative + possessive forms
16 function convertGrammar( $word, $case, $variant ) {
17 global $wgGrammarForms;
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 ); }
25 function convertGrammarKk_cyrl( $word, $case ) {
26 global $wgGrammarForms;
27 if ( isset( $wgGrammarForms['kk-kz'][$case][$word] ) ) {
28 return $wgGrammarForms['kk-kz'][$case][$word];
30 if ( isset( $wgGrammarForms['kk-cyrl'][$case][$word] ) ) {
31 return $wgGrammarForms['kk-cyrl'][$case][$word];
33 // Set up some constants...
34 // Vowels in last syllable
35 $frontVowels = array( "е", "ө", "ү", "і", "ә", "э", "я", "ё", "и" );
36 $backVowels = array( "а", "о", "ұ", "ы" );
37 $allVowels = array( "е", "ө", "ү", "і", "ә", "э", "а", "о", "ұ", "ы", "я", "ё", "и" );
40 $Nasals = array( "м", "н", "ң" );
41 $Sonants = array( "и", "й", "л", "р", "у", "ю");
42 $Consonants = array( "п", "ф", "к", "қ", "т", "ш", "с", "х", "ц", "ч", "щ", "б", "в", "г", "д" );
43 $Sibilants = array( "ж", "з" );
44 $Sonorants = array( "и", "й", "л", "р", "у", "ю", "м", "н", "ң", "ж", "з");
47 $firstPerson = array( "м", "ң" ); // 1st singular, 2nd unformal
48 $secondPerson = array( "з" ); // 1st plural, 2nd formal
49 $thirdPerson = array( "ы", "і" ); // 3rd
51 $lastLetter = self
::lastLetter( $word, $allVowels );
52 $wordEnding = $lastLetter[0];
53 $wordLastVowel = $lastLetter[1];
55 // Now convert the word
58 case "genitive": #ilik
59 if ( in_array( $wordEnding, $Consonants ) ) {
60 if ( in_array( $wordLastVowel, $frontVowels ) ) {
61 $word = $word . "тің";
62 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
63 $word = $word . "тың";
65 } elseif ( in_array( $wordEnding, $Vowels ) ||
in_array( $wordEnding, $Nasals ) ) {
66 if ( in_array( $wordLastVowel, $frontVowels ) ) {
67 $word = $word . "нің";
68 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
69 $word = $word . "ның";
71 } elseif ( in_array( $wordEnding, $Sonants ) ||
in_array( $wordEnding, $Sibilants )) {
72 if ( in_array( $wordLastVowel, $frontVowels ) ) {
73 $word = $word . "дің";
74 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
75 $word = $word . "дың";
81 if ( in_array( $wordEnding, $Consonants ) ) {
82 if ( in_array( $wordLastVowel, $frontVowels ) ) {
84 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
87 } elseif ( in_array( $wordEnding, $Vowels ) ||
in_array( $wordEnding, $Sonorants ) ) {
88 if ( in_array( $wordLastVowel, $frontVowels ) ) {
90 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
96 case "possessive dative": #täweldık + barıs
97 if ( in_array( $wordEnding, $firstPerson ) ) {
98 if ( in_array( $wordLastVowel, $frontVowels ) ) {
100 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
103 } elseif ( in_array( $wordEnding, $secondPerson ) ) {
104 if ( in_array( $wordLastVowel, $frontVowels ) ) {
105 $word = $word . "ге";
106 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
107 $word = $word . "ға";
109 } elseif ( in_array( $wordEnding, $thirdPerson ) ) {
110 if ( in_array( $wordLastVowel, $frontVowels ) ) {
111 $word = $word . "не";
112 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
113 $word = $word . "на";
118 case "accusative": #tabıs
119 if ( in_array( $wordEnding, $Consonants ) ) {
120 if ( in_array( $wordLastVowel, $frontVowels ) ) {
121 $word = $word . "ті";
122 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
123 $word = $word . "ты";
125 } elseif ( in_array( $wordEnding, $Vowels ) ) {
126 if ( in_array($wordLastVowel, $frontVowels ) ) {
127 $word = $word . "ні";
128 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
129 $word = $word . "ны";
131 } elseif ( in_array( $wordEnding, $Sonorants) ) {
132 if ( in_array( $wordLastVowel, $frontVowels) ) {
133 $word = $word . "ді";
134 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
135 $word = $word . "ды";
140 case "possessive accusative": #täweldık + tabıs
141 if ( in_array( $wordEnding, $firstPerson ) ||
in_array( $wordEnding, $secondPerson ) ) {
142 if ( in_array( $wordLastVowel, $frontVowels ) ) {
143 $word = $word . "ді";
144 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
145 $word = $word . "ды";
147 } elseif ( in_array( $wordEnding, $thirdPerson ) ) {
152 case "locative": #jatıs
153 if ( in_array( $wordEnding, $Consonants ) ) {
154 if ( in_array( $wordLastVowel, $frontVowels ) ) {
155 $word = $word . "те";
156 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
157 $word = $word . "та";
159 } elseif ( in_array( $wordEnding, $Vowels ) ||
in_array( $wordEnding, $Sonorants ) ) {
160 if ( in_array( $wordLastVowel, $frontVowels) ) {
161 $word = $word . "де";
162 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
163 $word = $word . "да";
168 case "possessive locative": #täweldık + jatıs
169 if ( in_array( $wordEnding, $firstPerson ) ||
in_array( $wordEnding, $secondPerson ) ) {
170 if ( in_array( $wordLastVowel, $frontVowels ) ) {
171 $word = $word . "де";
172 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
173 $word = $word . "да";
175 } elseif ( in_array( $wordEnding, $thirdPerson ) ) {
176 if ( in_array( $wordLastVowel, $frontVowels) ) {
177 $word = $word . "нде";
178 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
179 $word = $word . "нда";
184 case "ablative": #şığıs
185 if ( in_array( $wordEnding, $Consonants ) ) {
186 if ( in_array( $wordLastVowel, $frontVowels ) ) {
187 $word = $word . "тен";
188 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
189 $word = $word . "тан";
191 } elseif ( in_array($wordEnding, $Vowels ) ||
in_array($wordEnding, $Sonants ) ||
in_array($wordEnding, $Sibilants ) ) {
192 if ( in_array( $wordLastVowel, $frontVowels ) ) {
193 $word = $word . "ден";
194 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
195 $word = $word . "дан";
197 } elseif ( in_array($wordEnding, $Nasals ) ) {
198 if ( in_array( $wordLastVowel, $frontVowels ) ) {
199 $word = $word . "нен";
200 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
201 $word = $word . "нан";
206 case "possessive ablative": #täweldık + şığıs
207 if ( in_array( $wordEnding, $firstPerson ) ||
in_array( $wordEnding, $thirdPerson ) ) {
208 if ( in_array( $wordLastVowel, $frontVowels ) ) {
209 $word = $word . "нен";
210 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
211 $word = $word . "нан";
213 } elseif ( in_array($wordEnding, $secondPerson ) ) {
214 if ( in_array( $wordLastVowel, $frontVowels ) ) {
215 $word = $word . "ден";
216 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
217 $word = $word . "дан";
222 case "comitative": #kömektes
223 if ( in_array( $wordEnding, $Consonants ) ) {
224 $word = $word . "пен";
225 } elseif ( in_array( $wordEnding, $Vowels ) ||
in_array( $wordEnding, $Nasals ) ||
in_array( $wordEnding, $Sonants ) ) {
226 $word = $word . "мен";
227 } elseif ( in_array( $wordEnding, $Sibilants ) ) {
228 $word = $word . "бен";
232 case "possessive comitative": #täweldık + kömektes
233 if ( in_array( $wordEnding, $Consonants ) ) {
234 $word = $word . "пенен";
235 } elseif ( in_array( $wordEnding, $Vowels ) ||
in_array( $wordEnding, $Nasals ) ||
in_array( $wordEnding, $Sonants ) ) {
236 $word = $word . "менен";
237 } elseif ( in_array( $wordEnding, $Sibilants ) ) {
238 $word = $word . "бенен";
241 default: #dc0 #nominative #ataw
246 function convertGrammarKk_latn( $word, $case ) {
247 global $wgGrammarForms;
248 if ( isset( $wgGrammarForms['kk-tr'][$case][$word] ) ) {
249 return $wgGrammarForms['kk-tr'][$case][$word];
251 if ( isset( $wgGrammarForms['kk-latn'][$case][$word] ) ) {
252 return $wgGrammarForms['kk-latn'][$case][$word];
254 // Set up some constants...
255 // Vowels in last syllable
256 $frontVowels = array( "e", "ö", "ü", "i", "ä", "é" );
257 $backVowels = array( "a", "o", "u", "ı" );
258 $allVowels = array( "e", "ö", "ü", "i", "ä", "é", "a", "o", "u", "ı" );
260 $Vowels = $allVowels;
261 $Nasals = array( "m", "n", "ñ" );
262 $Sonants = array( "ï", "y", "ý", "l", "r", "w");
263 $Consonants = array( "p", "f", "k", "q", "t", "ş", "s", "x", "c", "ç", "b", "v", "g", "d" );
264 $Sibilants = array( "j", "z" );
265 $Sonorants = array( "ï", "y", "ý", "l", "r", "w", "m", "n", "ñ", "j", "z");
268 $firstPerson = array( "m", "ñ" ); // 1st singular, 2nd unformal
269 $secondPerson = array( "z" ); // 1st plural, 2nd formal
270 $thirdPerson = array( "ı", "i" ); // 3rd
272 $lastLetter = self
::lastLetter( $word, $allVowels );
273 $wordEnding = $lastLetter[0];
274 $wordLastVowel = $lastLetter[1];
276 // Now convert the word
279 case "genitive": #ilik
280 if ( in_array( $wordEnding, $Consonants ) ) {
281 if ( in_array( $wordLastVowel, $frontVowels ) ) {
282 $word = $word . "tiñ";
283 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
284 $word = $word . "tıñ";
286 } elseif ( in_array( $wordEnding, $Vowels ) ||
in_array( $wordEnding, $Nasals ) ) {
287 if ( in_array( $wordLastVowel, $frontVowels ) ) {
288 $word = $word . "niñ";
289 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
290 $word = $word . "nıñ";
292 } elseif ( in_array( $wordEnding, $Sonants ) ||
in_array( $wordEnding, $Sibilants )) {
293 if ( in_array( $wordLastVowel, $frontVowels ) ) {
294 $word = $word . "diñ";
295 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
296 $word = $word . "dıñ";
301 case "dative": #barıs
302 if ( in_array( $wordEnding, $Consonants ) ) {
303 if ( in_array( $wordLastVowel, $frontVowels ) ) {
304 $word = $word . "ke";
305 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
306 $word = $word . "qa";
308 } elseif ( in_array( $wordEnding, $Vowels ) ||
in_array( $wordEnding, $Sonorants ) ) {
309 if ( in_array( $wordLastVowel, $frontVowels ) ) {
310 $word = $word . "ge";
311 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
312 $word = $word . "ğa";
317 case "possessive dative": #täweldık + barıs
318 if ( in_array( $wordEnding, $firstPerson ) ) {
319 if ( in_array( $wordLastVowel, $frontVowels ) ) {
321 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
324 } elseif ( in_array( $wordEnding, $secondPerson ) ) {
325 if ( in_array( $wordLastVowel, $frontVowels ) ) {
326 $word = $word . "ge";
327 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
328 $word = $word . "ğa";
330 } elseif ( in_array( $wordEnding, $thirdPerson ) ) {
331 if ( in_array( $wordLastVowel, $frontVowels ) ) {
332 $word = $word . "ne";
333 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
334 $word = $word . "na";
339 case "accusative": #tabıs
340 if ( in_array( $wordEnding, $Consonants ) ) {
341 if ( in_array( $wordLastVowel, $frontVowels ) ) {
342 $word = $word . "ti";
343 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
344 $word = $word . "tı";
346 } elseif ( in_array( $wordEnding, $Vowels ) ) {
347 if ( in_array($wordLastVowel, $frontVowels ) ) {
348 $word = $word . "ni";
349 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
350 $word = $word . "nı";
352 } elseif ( in_array( $wordEnding, $Sonorants) ) {
353 if ( in_array( $wordLastVowel, $frontVowels) ) {
354 $word = $word . "di";
355 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
356 $word = $word . "dı";
361 case "possessive accusative": #täweldık + tabıs
362 if ( in_array( $wordEnding, $firstPerson ) ||
in_array( $wordEnding, $secondPerson ) ) {
363 if ( in_array( $wordLastVowel, $frontVowels ) ) {
364 $word = $word . "di";
365 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
366 $word = $word . "dı";
368 } elseif ( in_array( $wordEnding, $thirdPerson ) ) {
373 case "locative": #jatıs
374 if ( in_array( $wordEnding, $Consonants ) ) {
375 if ( in_array( $wordLastVowel, $frontVowels ) ) {
376 $word = $word . "te";
377 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
378 $word = $word . "ta";
380 } elseif ( in_array( $wordEnding, $Vowels ) ||
in_array( $wordEnding, $Sonorants ) ) {
381 if ( in_array( $wordLastVowel, $frontVowels) ) {
382 $word = $word . "de";
383 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
384 $word = $word . "da";
389 case "possessive locative": #täweldık + jatıs
390 if ( in_array( $wordEnding, $firstPerson ) ||
in_array( $wordEnding, $secondPerson ) ) {
391 if ( in_array( $wordLastVowel, $frontVowels ) ) {
392 $word = $word . "de";
393 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
394 $word = $word . "da";
396 } elseif ( in_array( $wordEnding, $thirdPerson ) ) {
397 if ( in_array( $wordLastVowel, $frontVowels) ) {
398 $word = $word . "nde";
399 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
400 $word = $word . "nda";
405 case "ablative": #şığıs
406 if ( in_array( $wordEnding, $Consonants ) ) {
407 if ( in_array( $wordLastVowel, $frontVowels ) ) {
408 $word = $word . "ten";
409 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
410 $word = $word . "tan";
412 } elseif ( in_array($wordEnding, $Vowels ) ||
in_array($wordEnding, $Sonants ) ||
in_array($wordEnding, $Sibilants ) ) {
413 if ( in_array( $wordLastVowel, $frontVowels ) ) {
414 $word = $word . "den";
415 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
416 $word = $word . "dan";
418 } elseif ( in_array($wordEnding, $Nasals ) ) {
419 if ( in_array( $wordLastVowel, $frontVowels ) ) {
420 $word = $word . "nen";
421 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
422 $word = $word . "nan";
427 case "possessive ablative": #täweldık + şığıs
428 if ( in_array( $wordEnding, $firstPerson ) ||
in_array( $wordEnding, $thirdPerson ) ) {
429 if ( in_array( $wordLastVowel, $frontVowels ) ) {
430 $word = $word . "nen";
431 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
432 $word = $word . "nan";
434 } elseif ( in_array($wordEnding, $secondPerson ) ) {
435 if ( in_array( $wordLastVowel, $frontVowels ) ) {
436 $word = $word . "den";
437 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
438 $word = $word . "dan";
443 case "comitative": #kömektes
444 if ( in_array( $wordEnding, $Consonants ) ) {
445 $word = $word . "pen";
446 } elseif ( in_array( $wordEnding, $Vowels ) ||
in_array( $wordEnding, $Nasals ) ||
in_array( $wordEnding, $Sonants ) ) {
447 $word = $word . "men";
448 } elseif ( in_array( $wordEnding, $Sibilants ) ) {
449 $word = $word . "ben";
453 case "possessive comitative": #täweldık + kömektes
454 if ( in_array( $wordEnding, $Consonants ) ) {
455 $word = $word . "penen";
456 } elseif ( in_array( $wordEnding, $Vowels ) ||
in_array( $wordEnding, $Nasals ) ||
in_array( $wordEnding, $Sonants ) ) {
457 $word = $word . "menen";
458 } elseif ( in_array( $wordEnding, $Sibilants ) ) {
459 $word = $word . "benen";
462 default: #dc0 #nominative #ataw
467 function convertGrammarKk_arab( $word, $case ) {
468 global $wgGrammarForms;
469 if ( isset( $wgGrammarForms['kk-cn'][$case][$word] ) ) {
470 return $wgGrammarForms['kk-cn'][$case][$word];
472 if ( isset( $wgGrammarForms['kk-arab'][$case][$word] ) ) {
473 return $wgGrammarForms['kk-arab'][$case][$word];
475 // Set up some constants...
476 // Vowels in last syllable
477 $frontVowels = array( "ە", "ٶ", "ٷ", "ٸ", "ٵ", "ە" );
478 $backVowels = array( "ا", "و", "ۇ", "ى" );
479 $allVowels = array( "ە", "ٶ", "ٷ", "ٸ", "ٵ", "ە", "ا", "و", "ۇ", "ى" );
481 $Vowels = $allVowels;
482 $Nasals = array( "م", "ن", "ڭ" );
483 $Sonants = array( "ي", "ي", "ل", "ر", "ۋ");
484 $Consonants = array( "پ", "ف", "ك", "ق", "ت", "ش", "س", "ح", "تس", "چ", "ب", "ۆ", "گ", "د" );
485 $Sibilants = array( "ج", "ز" );
486 $Sonorants = array( "ي", "ي", "ل", "ر", "ۋ", "م", "ن", "ڭ", "ج", "ز");
489 $firstPerson = array( "م", "ڭ" ); // 1st singular, 2nd unformal
490 $secondPerson = array( "ز" ); // 1st plural, 2nd formal
491 $thirdPerson = array( "ى", "ٸ" ); // 3rd
493 $lastLetter = self
::lastLetter( $word, $allVowels );
494 $wordEnding = $lastLetter[0];
495 $wordLastVowel = $lastLetter[1];
497 // Now convert the word
500 case "genitive": #ilik
501 if ( in_array( $wordEnding, $Consonants ) ) {
502 if ( in_array( $wordLastVowel, $frontVowels ) ) {
503 $word = $word . "تٸڭ";
504 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
505 $word = $word . "تىڭ";
507 } elseif ( in_array( $wordEnding, $Vowels ) ||
in_array( $wordEnding, $Nasals ) ) {
508 if ( in_array( $wordLastVowel, $frontVowels ) ) {
509 $word = $word . "نٸڭ";
510 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
511 $word = $word . "نىڭ";
513 } elseif ( in_array( $wordEnding, $Sonants ) ||
in_array( $wordEnding, $Sibilants )) {
514 if ( in_array( $wordLastVowel, $frontVowels ) ) {
515 $word = $word . "دٸڭ";
516 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
517 $word = $word . "دىڭ";
522 case "dative": #barıs
523 if ( in_array( $wordEnding, $Consonants ) ) {
524 if ( in_array( $wordLastVowel, $frontVowels ) ) {
525 $word = $word . "كە";
526 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
527 $word = $word . "قا";
529 } elseif ( in_array( $wordEnding, $Vowels ) ||
in_array( $wordEnding, $Sonorants ) ) {
530 if ( in_array( $wordLastVowel, $frontVowels ) ) {
531 $word = $word . "گە";
532 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
533 $word = $word . "عا";
538 case "possessive dative": #täweldık + barıs
539 if ( in_array( $wordEnding, $firstPerson ) ) {
540 if ( in_array( $wordLastVowel, $frontVowels ) ) {
542 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
545 } elseif ( in_array( $wordEnding, $secondPerson ) ) {
546 if ( in_array( $wordLastVowel, $frontVowels ) ) {
547 $word = $word . "گە";
548 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
549 $word = $word . "عا";
551 } elseif ( in_array( $wordEnding, $thirdPerson ) ) {
552 if ( in_array( $wordLastVowel, $frontVowels ) ) {
553 $word = $word . "نە";
554 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
555 $word = $word . "نا";
560 case "accusative": #tabıs
561 if ( in_array( $wordEnding, $Consonants ) ) {
562 if ( in_array( $wordLastVowel, $frontVowels ) ) {
563 $word = $word . "تٸ";
564 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
565 $word = $word . "تى";
567 } elseif ( in_array( $wordEnding, $Vowels ) ) {
568 if ( in_array($wordLastVowel, $frontVowels ) ) {
569 $word = $word . "نٸ";
570 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
571 $word = $word . "نى";
573 } elseif ( in_array( $wordEnding, $Sonorants) ) {
574 if ( in_array( $wordLastVowel, $frontVowels) ) {
575 $word = $word . "دٸ";
576 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
577 $word = $word . "دى";
582 case "possessive accusative": #täweldık + tabıs
583 if ( in_array( $wordEnding, $firstPerson ) ||
in_array( $wordEnding, $secondPerson ) ) {
584 if ( in_array( $wordLastVowel, $frontVowels ) ) {
585 $word = $word . "دٸ";
586 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
587 $word = $word . "دى";
589 } elseif ( in_array( $wordEnding, $thirdPerson ) ) {
594 case "locative": #jatıs
595 if ( in_array( $wordEnding, $Consonants ) ) {
596 if ( in_array( $wordLastVowel, $frontVowels ) ) {
597 $word = $word . "تە";
598 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
599 $word = $word . "تا";
601 } elseif ( in_array( $wordEnding, $Vowels ) ||
in_array( $wordEnding, $Sonorants ) ) {
602 if ( in_array( $wordLastVowel, $frontVowels) ) {
603 $word = $word . "دە";
604 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
605 $word = $word . "دا";
610 case "possessive locative": #täweldık + jatıs
611 if ( in_array( $wordEnding, $firstPerson ) ||
in_array( $wordEnding, $secondPerson ) ) {
612 if ( in_array( $wordLastVowel, $frontVowels ) ) {
613 $word = $word . "دە";
614 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
615 $word = $word . "دا";
617 } elseif ( in_array( $wordEnding, $thirdPerson ) ) {
618 if ( in_array( $wordLastVowel, $frontVowels) ) {
619 $word = $word . "ندە";
620 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
621 $word = $word . "ندا";
626 case "ablative": #şığıs
627 if ( in_array( $wordEnding, $Consonants ) ) {
628 if ( in_array( $wordLastVowel, $frontVowels ) ) {
629 $word = $word . "تەن";
630 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
631 $word = $word . "تان";
633 } elseif ( in_array($wordEnding, $Vowels ) ||
in_array($wordEnding, $Sonants ) ||
in_array($wordEnding, $Sibilants ) ) {
634 if ( in_array( $wordLastVowel, $frontVowels ) ) {
635 $word = $word . "دەن";
636 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
637 $word = $word . "دان";
639 } elseif ( in_array($wordEnding, $Nasals ) ) {
640 if ( in_array( $wordLastVowel, $frontVowels ) ) {
641 $word = $word . "نەن";
642 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
643 $word = $word . "نان";
648 case "possessive ablative": #täweldık + şığıs
649 if ( in_array( $wordEnding, $firstPerson ) ||
in_array( $wordEnding, $thirdPerson ) ) {
650 if ( in_array( $wordLastVowel, $frontVowels ) ) {
651 $word = $word . "نەن";
652 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
653 $word = $word . "نان";
655 } elseif ( in_array($wordEnding, $secondPerson ) ) {
656 if ( in_array( $wordLastVowel, $frontVowels ) ) {
657 $word = $word . "دەن";
658 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
659 $word = $word . "دان";
664 case "comitative": #kömektes
665 if ( in_array( $wordEnding, $Consonants ) ) {
666 $word = $word . "پەن";
667 } elseif ( in_array( $wordEnding, $Vowels ) ||
in_array( $wordEnding, $Nasals ) ||
in_array( $wordEnding, $Sonants ) ) {
668 $word = $word . "مەن";
669 } elseif ( in_array( $wordEnding, $Sibilants ) ) {
670 $word = $word . "بەن";
674 case "possessive comitative": #täweldık + kömektes
675 if ( in_array( $wordEnding, $Consonants ) ) {
676 $word = $word . "پەنەن";
677 } elseif ( in_array( $wordEnding, $Vowels ) ||
in_array( $wordEnding, $Nasals ) ||
in_array( $wordEnding, $Sonants ) ) {
678 $word = $word . "مەنەن";
679 } elseif ( in_array( $wordEnding, $Sibilants ) ) {
680 $word = $word . "بەنەن";
683 default: #dc0 #nominative #ataw
688 function lastLetter( $word, $allVowels ) {
689 $lastLetter = array();
692 // Put the word in a form we can play with since we're using UTF-8
693 $ar = preg_split('//u', parent
::lc($word), -1, PREG_SPLIT_NO_EMPTY
);
694 $wordReversed = array_reverse( $ar ); //Here's an array with the order of the letters in the word reversed so we can find a match quicker *shrug*
696 //Here's the last letter in the word
697 $lastLetter[0] = $ar[count( $ar ) - 1];
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;
710 if ( $lastLetter[1] !== NULL ) {
721 * Avoid grouping whole numbers between 0 to 9999
723 function commafy( $_ ) {
724 if ( !preg_match( '/^\d{1,4}$/', $_ ) ) {
725 return strrev( (string)preg_replace( '/(\d{3})(?=\d)(?!\d*\.)/', '$1,', strrev($_) ) );