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( "е", "ө", "ү", "і", "ә", "э", "а", "о", "ұ", "ы", "я", "ё", "и" );
39 $Nasals = array( "м", "н", "ң" );
40 $Sonants = array( "и", "й", "л", "р", "у", "ю");
41 $Consonants = array( "п", "ф", "к", "қ", "т", "ш", "с", "х", "ц", "ч", "щ", "б", "в", "г", "д" );
42 $Sibilants = array( "ж", "з" );
43 $Sonorants = array( "и", "й", "л", "р", "у", "ю", "м", "н", "ң", "ж", "з");
46 $firstPerson = array( "м", "ң" ); // 1st singular, 2nd unformal
47 $secondPerson = array( "з" ); // 1st plural, 2nd formal
48 $thirdPerson = array( "ы", "і" ); // 3rd
50 $lastLetter = self
::lastLetter( $word, $allVowels );
51 $wordEnding =& $lastLetter[0];
52 $wordLastVowel =& $lastLetter[1];
54 // Now convert the word
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 . "тың";
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 . "ның";
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 . "дың";
80 if ( in_array( $wordEnding, $Consonants ) ) {
81 if ( in_array( $wordLastVowel, $frontVowels ) ) {
83 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
86 } elseif ( in_array( $wordEnding, $allVowels ) ||
in_array( $wordEnding, $Sonorants ) ) {
87 if ( in_array( $wordLastVowel, $frontVowels ) ) {
89 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
95 case "possessive dative": #täweldık + barıs
96 if ( in_array( $wordEnding, $firstPerson ) ) {
97 if ( in_array( $wordLastVowel, $frontVowels ) ) {
99 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
102 } elseif ( in_array( $wordEnding, $secondPerson ) ) {
103 if ( in_array( $wordLastVowel, $frontVowels ) ) {
104 $word = $word . "ге";
105 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
106 $word = $word . "ға";
108 } elseif ( in_array( $wordEnding, $thirdPerson ) ) {
109 if ( in_array( $wordLastVowel, $frontVowels ) ) {
110 $word = $word . "не";
111 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
112 $word = $word . "на";
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 . "ты";
124 } elseif ( in_array( $wordEnding, $allVowels ) ) {
125 if ( in_array($wordLastVowel, $frontVowels ) ) {
126 $word = $word . "ні";
127 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
128 $word = $word . "ны";
130 } elseif ( in_array( $wordEnding, $Sonorants) ) {
131 if ( in_array( $wordLastVowel, $frontVowels) ) {
132 $word = $word . "ді";
133 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
134 $word = $word . "ды";
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 . "ды";
146 } elseif ( in_array( $wordEnding, $thirdPerson ) ) {
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 . "та";
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 . "да";
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 . "да";
174 } elseif ( in_array( $wordEnding, $thirdPerson ) ) {
175 if ( in_array( $wordLastVowel, $frontVowels) ) {
176 $word = $word . "нде";
177 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
178 $word = $word . "нда";
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 . "тан";
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 . "дан";
196 } elseif ( in_array($wordEnding, $Nasals ) ) {
197 if ( in_array( $wordLastVowel, $frontVowels ) ) {
198 $word = $word . "нен";
199 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
200 $word = $word . "нан";
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 . "нан";
212 } elseif ( in_array($wordEnding, $secondPerson ) ) {
213 if ( in_array( $wordLastVowel, $frontVowels ) ) {
214 $word = $word . "ден";
215 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
216 $word = $word . "дан";
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 . "бен";
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 . "бенен";
240 default: #dc0 #nominative #ataw
245 function convertGrammarKk_latn( $word, $case ) {
246 global $wgGrammarForms;
247 if ( isset( $wgGrammarForms['kk-tr'][$case][$word] ) ) {
248 return $wgGrammarForms['kk-tr'][$case][$word];
250 if ( isset( $wgGrammarForms['kk-latn'][$case][$word] ) ) {
251 return $wgGrammarForms['kk-latn'][$case][$word];
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", "ı" );
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");
266 $firstPerson = array( "m", "ñ" ); // 1st singular, 2nd unformal
267 $secondPerson = array( "z" ); // 1st plural, 2nd formal
268 $thirdPerson = array( "ı", "i" ); // 3rd
270 $lastLetter = self
::lastLetter( $word, $allVowels );
271 $wordEnding =& $lastLetter[0];
272 $wordLastVowel =& $lastLetter[1];
274 // Now convert the word
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ıñ";
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ıñ";
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ıñ";
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";
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";
315 case "possessive dative": #täweldık + barıs
316 if ( in_array( $wordEnding, $firstPerson ) ) {
317 if ( in_array( $wordLastVowel, $frontVowels ) ) {
319 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
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";
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";
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ı";
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ı";
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ı";
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ı";
366 } elseif ( in_array( $wordEnding, $thirdPerson ) ) {
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";
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";
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";
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";
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";
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";
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";
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";
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";
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";
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";
460 default: #dc0 #nominative #ataw
465 function convertGrammarKk_arab( $word, $case ) {
466 global $wgGrammarForms;
467 if ( isset( $wgGrammarForms['kk-cn'][$case][$word] ) ) {
468 return $wgGrammarForms['kk-cn'][$case][$word];
470 if ( isset( $wgGrammarForms['kk-arab'][$case][$word] ) ) {
471 return $wgGrammarForms['kk-arab'][$case][$word];
473 // Set up some constants...
474 // Vowels in last syllable
475 $frontVowels = array( "ە", "ٶ", "ٷ", "ٸ", "ٵ", "ە" );
476 $backVowels = array( "ا", "و", "ۇ", "ى" );
477 $allVowels = array( "ە", "ٶ", "ٷ", "ٸ", "ٵ", "ە", "ا", "و", "ۇ", "ى" );
479 $Nasals = array( "م", "ن", "ڭ" );
480 $Sonants = array( "ي", "ي", "ل", "ر", "ۋ");
481 $Consonants = array( "پ", "ف", "ك", "ق", "ت", "ش", "س", "ح", "تس", "چ", "ب", "ۆ", "گ", "د" );
482 $Sibilants = array( "ج", "ز" );
483 $Sonorants = array( "ي", "ي", "ل", "ر", "ۋ", "م", "ن", "ڭ", "ج", "ز");
486 $firstPerson = array( "م", "ڭ" ); // 1st singular, 2nd unformal
487 $secondPerson = array( "ز" ); // 1st plural, 2nd formal
488 $thirdPerson = array( "ى", "ٸ" ); // 3rd
490 $lastLetter = self
::lastLetter( $word, $allVowels );
491 $wordEnding =& $lastLetter[0];
492 $wordLastVowel =& $lastLetter[1];
494 // Now convert the word
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 . "تىڭ";
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 . "نىڭ";
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 . "دىڭ";
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 . "قا";
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 . "عا";
535 case "possessive dative": #täweldık + barıs
536 if ( in_array( $wordEnding, $firstPerson ) ) {
537 if ( in_array( $wordLastVowel, $frontVowels ) ) {
539 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
542 } elseif ( in_array( $wordEnding, $secondPerson ) ) {
543 if ( in_array( $wordLastVowel, $frontVowels ) ) {
544 $word = $word . "گە";
545 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
546 $word = $word . "عا";
548 } elseif ( in_array( $wordEnding, $thirdPerson ) ) {
549 if ( in_array( $wordLastVowel, $frontVowels ) ) {
550 $word = $word . "نە";
551 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
552 $word = $word . "نا";
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 . "تى";
564 } elseif ( in_array( $wordEnding, $allVowels ) ) {
565 if ( in_array($wordLastVowel, $frontVowels ) ) {
566 $word = $word . "نٸ";
567 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
568 $word = $word . "نى";
570 } elseif ( in_array( $wordEnding, $Sonorants) ) {
571 if ( in_array( $wordLastVowel, $frontVowels) ) {
572 $word = $word . "دٸ";
573 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
574 $word = $word . "دى";
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 . "دى";
586 } elseif ( in_array( $wordEnding, $thirdPerson ) ) {
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 . "تا";
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 . "دا";
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 . "دا";
614 } elseif ( in_array( $wordEnding, $thirdPerson ) ) {
615 if ( in_array( $wordLastVowel, $frontVowels) ) {
616 $word = $word . "ندە";
617 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
618 $word = $word . "ندا";
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 . "تان";
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 . "دان";
636 } elseif ( in_array($wordEnding, $Nasals ) ) {
637 if ( in_array( $wordLastVowel, $frontVowels ) ) {
638 $word = $word . "نەن";
639 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
640 $word = $word . "نان";
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 . "نان";
652 } elseif ( in_array($wordEnding, $secondPerson ) ) {
653 if ( in_array( $wordLastVowel, $frontVowels ) ) {
654 $word = $word . "دەن";
655 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
656 $word = $word . "دان";
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 . "بەن";
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 . "بەنەن";
680 default: #dc0 #nominative #ataw
685 function lastLetter( $word, $allVowels ) {
686 $lastLetter = array();
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
);
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 );
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($_) ) );