3 * Kazakh (Қазақша) specific code.
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 * http://www.gnu.org/copyleft/gpl.html
29 class LanguageKk_cyrl
extends Language
{
31 # Convert from the nominative form of a noun to some other case
32 # Invoked with {{GRAMMAR:case|word}}
34 * Cases: genitive, dative, accusative, locative, ablative, comitative + possessive forms
41 function convertGrammarKk_cyrl( $word, $case ) {
42 global $wgGrammarForms;
43 if ( isset( $wgGrammarForms['kk-kz'][$case][$word] ) ) {
44 return $wgGrammarForms['kk-kz'][$case][$word];
46 if ( isset( $wgGrammarForms['kk-cyrl'][$case][$word] ) ) {
47 return $wgGrammarForms['kk-cyrl'][$case][$word];
49 // Set up some constants...
50 // Vowels in last syllable
51 $frontVowels = array( "е", "ө", "ү", "і", "ә", "э", "я", "ё", "и" );
52 $backVowels = array( "а", "о", "ұ", "ы" );
53 $allVowels = array( "е", "ө", "ү", "і", "ә", "э", "а", "о", "ұ", "ы", "я", "ё", "и" );
55 $Nasals = array( "м", "н", "ң" );
56 $Sonants = array( "и", "й", "л", "р", "у", "ю" );
57 $Consonants = array( "п", "ф", "к", "қ", "т", "ш", "с", "х", "ц", "ч", "щ", "б", "в", "г", "д" );
58 $Sibilants = array( "ж", "з" );
59 $Sonorants = array( "и", "й", "л", "р", "у", "ю", "м", "н", "ң", "ж", "з" );
62 $firstPerson = array( "м", "ң" ); // 1st singular, 2nd unformal
63 $secondPerson = array( "з" ); // 1st plural, 2nd formal
64 $thirdPerson = array( "ы", "і" ); // 3rd
66 $lastLetter = $this->lastLetter( $word, $allVowels );
67 $wordEnding =& $lastLetter[0];
68 $wordLastVowel =& $lastLetter[1];
70 // Now convert the word
73 case "genitive": # ilik
74 if ( in_array( $wordEnding, $Consonants ) ) {
75 if ( in_array( $wordLastVowel, $frontVowels ) ) {
76 $word = $word . "тің";
77 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
78 $word = $word . "тың";
80 } elseif ( in_array( $wordEnding, $allVowels ) ||
in_array( $wordEnding, $Nasals ) ) {
81 if ( in_array( $wordLastVowel, $frontVowels ) ) {
82 $word = $word . "нің";
83 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
84 $word = $word . "ның";
86 } elseif ( in_array( $wordEnding, $Sonants ) ||
in_array( $wordEnding, $Sibilants ) ) {
87 if ( in_array( $wordLastVowel, $frontVowels ) ) {
88 $word = $word . "дің";
89 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
90 $word = $word . "дың";
95 case "dative": # barıs
96 if ( in_array( $wordEnding, $Consonants ) ) {
97 if ( in_array( $wordLastVowel, $frontVowels ) ) {
99 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
100 $word = $word . "қа";
102 } elseif ( in_array( $wordEnding, $allVowels ) ||
in_array( $wordEnding, $Sonorants ) ) {
103 if ( in_array( $wordLastVowel, $frontVowels ) ) {
104 $word = $word . "ге";
105 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
106 $word = $word . "ға";
111 case "possessive dative": # täweldık + barıs
112 if ( in_array( $wordEnding, $firstPerson ) ) {
113 if ( in_array( $wordLastVowel, $frontVowels ) ) {
115 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
118 } elseif ( in_array( $wordEnding, $secondPerson ) ) {
119 if ( in_array( $wordLastVowel, $frontVowels ) ) {
120 $word = $word . "ге";
121 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
122 $word = $word . "ға";
124 } elseif ( in_array( $wordEnding, $thirdPerson ) ) {
125 if ( in_array( $wordLastVowel, $frontVowels ) ) {
126 $word = $word . "не";
127 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
128 $word = $word . "на";
133 case "accusative": # tabıs
134 if ( in_array( $wordEnding, $Consonants ) ) {
135 if ( in_array( $wordLastVowel, $frontVowels ) ) {
136 $word = $word . "ті";
137 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
138 $word = $word . "ты";
140 } elseif ( in_array( $wordEnding, $allVowels ) ) {
141 if ( in_array( $wordLastVowel, $frontVowels ) ) {
142 $word = $word . "ні";
143 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
144 $word = $word . "ны";
146 } elseif ( in_array( $wordEnding, $Sonorants ) ) {
147 if ( in_array( $wordLastVowel, $frontVowels ) ) {
148 $word = $word . "ді";
149 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
150 $word = $word . "ды";
155 case "possessive accusative": # täweldık + tabıs
156 if ( in_array( $wordEnding, $firstPerson ) ||
in_array( $wordEnding, $secondPerson ) ) {
157 if ( in_array( $wordLastVowel, $frontVowels ) ) {
158 $word = $word . "ді";
159 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
160 $word = $word . "ды";
162 } elseif ( in_array( $wordEnding, $thirdPerson ) ) {
167 case "locative": # jatıs
168 if ( in_array( $wordEnding, $Consonants ) ) {
169 if ( in_array( $wordLastVowel, $frontVowels ) ) {
170 $word = $word . "те";
171 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
172 $word = $word . "та";
174 } elseif ( in_array( $wordEnding, $allVowels ) ||
in_array( $wordEnding, $Sonorants ) ) {
175 if ( in_array( $wordLastVowel, $frontVowels ) ) {
176 $word = $word . "де";
177 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
178 $word = $word . "да";
183 case "possessive locative": # täweldık + jatıs
184 if ( in_array( $wordEnding, $firstPerson ) ||
in_array( $wordEnding, $secondPerson ) ) {
185 if ( in_array( $wordLastVowel, $frontVowels ) ) {
186 $word = $word . "де";
187 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
188 $word = $word . "да";
190 } elseif ( in_array( $wordEnding, $thirdPerson ) ) {
191 if ( in_array( $wordLastVowel, $frontVowels ) ) {
192 $word = $word . "нде";
193 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
194 $word = $word . "нда";
199 case "ablative": # şığıs
200 if ( in_array( $wordEnding, $Consonants ) ) {
201 if ( in_array( $wordLastVowel, $frontVowels ) ) {
202 $word = $word . "тен";
203 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
204 $word = $word . "тан";
206 } elseif ( in_array( $wordEnding, $allVowels ) ||
in_array( $wordEnding, $Sonants ) ||
in_array( $wordEnding, $Sibilants ) ) {
207 if ( in_array( $wordLastVowel, $frontVowels ) ) {
208 $word = $word . "ден";
209 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
210 $word = $word . "дан";
212 } elseif ( in_array( $wordEnding, $Nasals ) ) {
213 if ( in_array( $wordLastVowel, $frontVowels ) ) {
214 $word = $word . "нен";
215 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
216 $word = $word . "нан";
221 case "possessive ablative": # täweldık + şığıs
222 if ( in_array( $wordEnding, $firstPerson ) ||
in_array( $wordEnding, $thirdPerson ) ) {
223 if ( in_array( $wordLastVowel, $frontVowels ) ) {
224 $word = $word . "нен";
225 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
226 $word = $word . "нан";
228 } elseif ( in_array( $wordEnding, $secondPerson ) ) {
229 if ( in_array( $wordLastVowel, $frontVowels ) ) {
230 $word = $word . "ден";
231 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
232 $word = $word . "дан";
237 case "comitative": # kömektes
238 if ( in_array( $wordEnding, $Consonants ) ) {
239 $word = $word . "пен";
240 } elseif ( in_array( $wordEnding, $allVowels ) ||
in_array( $wordEnding, $Nasals ) ||
in_array( $wordEnding, $Sonants ) ) {
241 $word = $word . "мен";
242 } elseif ( in_array( $wordEnding, $Sibilants ) ) {
243 $word = $word . "бен";
247 case "possessive comitative": # täweldık + kömektes
248 if ( in_array( $wordEnding, $Consonants ) ) {
249 $word = $word . "пенен";
250 } elseif ( in_array( $wordEnding, $allVowels ) ||
in_array( $wordEnding, $Nasals ) ||
in_array( $wordEnding, $Sonants ) ) {
251 $word = $word . "менен";
252 } elseif ( in_array( $wordEnding, $Sibilants ) ) {
253 $word = $word . "бенен";
256 default: # dc0 #nominative #ataw
262 * @param $word string
263 * @param $case string
266 function convertGrammarKk_latn( $word, $case ) {
267 global $wgGrammarForms;
268 if ( isset( $wgGrammarForms['kk-tr'][$case][$word] ) ) {
269 return $wgGrammarForms['kk-tr'][$case][$word];
271 if ( isset( $wgGrammarForms['kk-latn'][$case][$word] ) ) {
272 return $wgGrammarForms['kk-latn'][$case][$word];
274 // Set up some constants...
275 // Vowels in last syllable
276 $frontVowels = array( "e", "ö", "ü", "i", "ä", "é" );
277 $backVowels = array( "a", "o", "u", "ı" );
278 $allVowels = array( "e", "ö", "ü", "i", "ä", "é", "a", "o", "u", "ı" );
280 $Nasals = array( "m", "n", "ñ" );
281 $Sonants = array( "ï", "y", "ý", "l", "r", "w" );
282 $Consonants = array( "p", "f", "k", "q", "t", "ş", "s", "x", "c", "ç", "b", "v", "g", "d" );
283 $Sibilants = array( "j", "z" );
284 $Sonorants = array( "ï", "y", "ý", "l", "r", "w", "m", "n", "ñ", "j", "z" );
287 $firstPerson = array( "m", "ñ" ); // 1st singular, 2nd unformal
288 $secondPerson = array( "z" ); // 1st plural, 2nd formal
289 $thirdPerson = array( "ı", "i" ); // 3rd
291 $lastLetter = $this->lastLetter( $word, $allVowels );
292 $wordEnding =& $lastLetter[0];
293 $wordLastVowel =& $lastLetter[1];
295 // Now convert the word
298 case "genitive": # ilik
299 if ( in_array( $wordEnding, $Consonants ) ) {
300 if ( in_array( $wordLastVowel, $frontVowels ) ) {
301 $word = $word . "tiñ";
302 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
303 $word = $word . "tıñ";
305 } elseif ( in_array( $wordEnding, $allVowels ) ||
in_array( $wordEnding, $Nasals ) ) {
306 if ( in_array( $wordLastVowel, $frontVowels ) ) {
307 $word = $word . "niñ";
308 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
309 $word = $word . "nıñ";
311 } elseif ( in_array( $wordEnding, $Sonants ) ||
in_array( $wordEnding, $Sibilants ) ) {
312 if ( in_array( $wordLastVowel, $frontVowels ) ) {
313 $word = $word . "diñ";
314 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
315 $word = $word . "dıñ";
320 case "dative": # barıs
321 if ( in_array( $wordEnding, $Consonants ) ) {
322 if ( in_array( $wordLastVowel, $frontVowels ) ) {
323 $word = $word . "ke";
324 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
325 $word = $word . "qa";
327 } elseif ( in_array( $wordEnding, $allVowels ) ||
in_array( $wordEnding, $Sonorants ) ) {
328 if ( in_array( $wordLastVowel, $frontVowels ) ) {
329 $word = $word . "ge";
330 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
331 $word = $word . "ğa";
336 case "possessive dative": # täweldık + barıs
337 if ( in_array( $wordEnding, $firstPerson ) ) {
338 if ( in_array( $wordLastVowel, $frontVowels ) ) {
340 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
343 } elseif ( in_array( $wordEnding, $secondPerson ) ) {
344 if ( in_array( $wordLastVowel, $frontVowels ) ) {
345 $word = $word . "ge";
346 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
347 $word = $word . "ğa";
349 } elseif ( in_array( $wordEnding, $thirdPerson ) ) {
350 if ( in_array( $wordLastVowel, $frontVowels ) ) {
351 $word = $word . "ne";
352 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
353 $word = $word . "na";
358 case "accusative": # tabıs
359 if ( in_array( $wordEnding, $Consonants ) ) {
360 if ( in_array( $wordLastVowel, $frontVowels ) ) {
361 $word = $word . "ti";
362 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
363 $word = $word . "tı";
365 } elseif ( in_array( $wordEnding, $allVowels ) ) {
366 if ( in_array( $wordLastVowel, $frontVowels ) ) {
367 $word = $word . "ni";
368 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
369 $word = $word . "nı";
371 } elseif ( in_array( $wordEnding, $Sonorants ) ) {
372 if ( in_array( $wordLastVowel, $frontVowels ) ) {
373 $word = $word . "di";
374 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
375 $word = $word . "dı";
380 case "possessive accusative": # täweldık + tabıs
381 if ( in_array( $wordEnding, $firstPerson ) ||
in_array( $wordEnding, $secondPerson ) ) {
382 if ( in_array( $wordLastVowel, $frontVowels ) ) {
383 $word = $word . "di";
384 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
385 $word = $word . "dı";
387 } elseif ( in_array( $wordEnding, $thirdPerson ) ) {
392 case "locative": # jatıs
393 if ( in_array( $wordEnding, $Consonants ) ) {
394 if ( in_array( $wordLastVowel, $frontVowels ) ) {
395 $word = $word . "te";
396 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
397 $word = $word . "ta";
399 } elseif ( in_array( $wordEnding, $allVowels ) ||
in_array( $wordEnding, $Sonorants ) ) {
400 if ( in_array( $wordLastVowel, $frontVowels ) ) {
401 $word = $word . "de";
402 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
403 $word = $word . "da";
408 case "possessive locative": # täweldık + jatıs
409 if ( in_array( $wordEnding, $firstPerson ) ||
in_array( $wordEnding, $secondPerson ) ) {
410 if ( in_array( $wordLastVowel, $frontVowels ) ) {
411 $word = $word . "de";
412 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
413 $word = $word . "da";
415 } elseif ( in_array( $wordEnding, $thirdPerson ) ) {
416 if ( in_array( $wordLastVowel, $frontVowels ) ) {
417 $word = $word . "nde";
418 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
419 $word = $word . "nda";
424 case "ablative": # şığıs
425 if ( in_array( $wordEnding, $Consonants ) ) {
426 if ( in_array( $wordLastVowel, $frontVowels ) ) {
427 $word = $word . "ten";
428 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
429 $word = $word . "tan";
431 } elseif ( in_array( $wordEnding, $allVowels ) ||
in_array( $wordEnding, $Sonants ) ||
in_array( $wordEnding, $Sibilants ) ) {
432 if ( in_array( $wordLastVowel, $frontVowels ) ) {
433 $word = $word . "den";
434 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
435 $word = $word . "dan";
437 } elseif ( in_array( $wordEnding, $Nasals ) ) {
438 if ( in_array( $wordLastVowel, $frontVowels ) ) {
439 $word = $word . "nen";
440 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
441 $word = $word . "nan";
446 case "possessive ablative": # täweldık + şığıs
447 if ( in_array( $wordEnding, $firstPerson ) ||
in_array( $wordEnding, $thirdPerson ) ) {
448 if ( in_array( $wordLastVowel, $frontVowels ) ) {
449 $word = $word . "nen";
450 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
451 $word = $word . "nan";
453 } elseif ( in_array( $wordEnding, $secondPerson ) ) {
454 if ( in_array( $wordLastVowel, $frontVowels ) ) {
455 $word = $word . "den";
456 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
457 $word = $word . "dan";
462 case "comitative": # kömektes
463 if ( in_array( $wordEnding, $Consonants ) ) {
464 $word = $word . "pen";
465 } elseif ( in_array( $wordEnding, $allVowels ) ||
in_array( $wordEnding, $Nasals ) ||
in_array( $wordEnding, $Sonants ) ) {
466 $word = $word . "men";
467 } elseif ( in_array( $wordEnding, $Sibilants ) ) {
468 $word = $word . "ben";
472 case "possessive comitative": # täweldık + kömektes
473 if ( in_array( $wordEnding, $Consonants ) ) {
474 $word = $word . "penen";
475 } elseif ( in_array( $wordEnding, $allVowels ) ||
in_array( $wordEnding, $Nasals ) ||
in_array( $wordEnding, $Sonants ) ) {
476 $word = $word . "menen";
477 } elseif ( in_array( $wordEnding, $Sibilants ) ) {
478 $word = $word . "benen";
481 default: # dc0 #nominative #ataw
487 * @param $word string
488 * @param $case string
491 function convertGrammarKk_arab( $word, $case ) {
492 global $wgGrammarForms;
493 if ( isset( $wgGrammarForms['kk-cn'][$case][$word] ) ) {
494 return $wgGrammarForms['kk-cn'][$case][$word];
496 if ( isset( $wgGrammarForms['kk-arab'][$case][$word] ) ) {
497 return $wgGrammarForms['kk-arab'][$case][$word];
499 // Set up some constants...
500 // Vowels in last syllable
501 $frontVowels = array( "ە", "ٶ", "ٷ", "ٸ", "ٵ", "ە" );
502 $backVowels = array( "ا", "و", "ۇ", "ى" );
503 $allVowels = array( "ە", "ٶ", "ٷ", "ٸ", "ٵ", "ە", "ا", "و", "ۇ", "ى" );
505 $Nasals = array( "م", "ن", "ڭ" );
506 $Sonants = array( "ي", "ي", "ل", "ر", "ۋ" );
507 $Consonants = array( "پ", "ف", "ك", "ق", "ت", "ش", "س", "ح", "تس", "چ", "ب", "ۆ", "گ", "د" );
508 $Sibilants = array( "ج", "ز" );
509 $Sonorants = array( "ي", "ي", "ل", "ر", "ۋ", "م", "ن", "ڭ", "ج", "ز" );
512 $firstPerson = array( "م", "ڭ" ); // 1st singular, 2nd unformal
513 $secondPerson = array( "ز" ); // 1st plural, 2nd formal
514 $thirdPerson = array( "ى", "ٸ" ); // 3rd
516 $lastLetter = $this->lastLetter( $word, $allVowels );
517 $wordEnding = $lastLetter[0];
518 $wordLastVowel = $lastLetter[1];
520 // Now convert the word
523 case "genitive": # ilik
524 if ( in_array( $wordEnding, $Consonants ) ) {
525 if ( in_array( $wordLastVowel, $frontVowels ) ) {
526 $word = $word . "تٸڭ";
527 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
528 $word = $word . "تىڭ";
530 } elseif ( in_array( $wordEnding, $allVowels ) ||
in_array( $wordEnding, $Nasals ) ) {
531 if ( in_array( $wordLastVowel, $frontVowels ) ) {
532 $word = $word . "نٸڭ";
533 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
534 $word = $word . "نىڭ";
536 } elseif ( in_array( $wordEnding, $Sonants ) ||
in_array( $wordEnding, $Sibilants ) ) {
537 if ( in_array( $wordLastVowel, $frontVowels ) ) {
538 $word = $word . "دٸڭ";
539 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
540 $word = $word . "دىڭ";
545 case "dative": # barıs
546 if ( in_array( $wordEnding, $Consonants ) ) {
547 if ( in_array( $wordLastVowel, $frontVowels ) ) {
548 $word = $word . "كە";
549 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
550 $word = $word . "قا";
552 } elseif ( in_array( $wordEnding, $allVowels ) ||
in_array( $wordEnding, $Sonorants ) ) {
553 if ( in_array( $wordLastVowel, $frontVowels ) ) {
554 $word = $word . "گە";
555 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
556 $word = $word . "عا";
561 case "possessive dative": # täweldık + barıs
562 if ( in_array( $wordEnding, $firstPerson ) ) {
563 if ( in_array( $wordLastVowel, $frontVowels ) ) {
565 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
568 } elseif ( in_array( $wordEnding, $secondPerson ) ) {
569 if ( in_array( $wordLastVowel, $frontVowels ) ) {
570 $word = $word . "گە";
571 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
572 $word = $word . "عا";
574 } elseif ( in_array( $wordEnding, $thirdPerson ) ) {
575 if ( in_array( $wordLastVowel, $frontVowels ) ) {
576 $word = $word . "نە";
577 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
578 $word = $word . "نا";
583 case "accusative": # tabı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 . "تى";
590 } elseif ( in_array( $wordEnding, $allVowels ) ) {
591 if ( in_array( $wordLastVowel, $frontVowels ) ) {
592 $word = $word . "نٸ";
593 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
594 $word = $word . "نى";
596 } elseif ( in_array( $wordEnding, $Sonorants ) ) {
597 if ( in_array( $wordLastVowel, $frontVowels ) ) {
598 $word = $word . "دٸ";
599 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
600 $word = $word . "دى";
605 case "possessive accusative": # täweldık + tabıs
606 if ( in_array( $wordEnding, $firstPerson ) ||
in_array( $wordEnding, $secondPerson ) ) {
607 if ( in_array( $wordLastVowel, $frontVowels ) ) {
608 $word = $word . "دٸ";
609 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
610 $word = $word . "دى";
612 } elseif ( in_array( $wordEnding, $thirdPerson ) ) {
617 case "locative": # jatıs
618 if ( in_array( $wordEnding, $Consonants ) ) {
619 if ( in_array( $wordLastVowel, $frontVowels ) ) {
620 $word = $word . "تە";
621 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
622 $word = $word . "تا";
624 } elseif ( in_array( $wordEnding, $allVowels ) ||
in_array( $wordEnding, $Sonorants ) ) {
625 if ( in_array( $wordLastVowel, $frontVowels ) ) {
626 $word = $word . "دە";
627 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
628 $word = $word . "دا";
633 case "possessive locative": # täweldık + jatıs
634 if ( in_array( $wordEnding, $firstPerson ) ||
in_array( $wordEnding, $secondPerson ) ) {
635 if ( in_array( $wordLastVowel, $frontVowels ) ) {
636 $word = $word . "دە";
637 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
638 $word = $word . "دا";
640 } elseif ( in_array( $wordEnding, $thirdPerson ) ) {
641 if ( in_array( $wordLastVowel, $frontVowels ) ) {
642 $word = $word . "ندە";
643 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
644 $word = $word . "ندا";
649 case "ablative": # şığıs
650 if ( in_array( $wordEnding, $Consonants ) ) {
651 if ( in_array( $wordLastVowel, $frontVowels ) ) {
652 $word = $word . "تەن";
653 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
654 $word = $word . "تان";
656 } elseif ( in_array( $wordEnding, $allVowels ) ||
in_array( $wordEnding, $Sonants ) ||
in_array( $wordEnding, $Sibilants ) ) {
657 if ( in_array( $wordLastVowel, $frontVowels ) ) {
658 $word = $word . "دەن";
659 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
660 $word = $word . "دان";
662 } elseif ( in_array( $wordEnding, $Nasals ) ) {
663 if ( in_array( $wordLastVowel, $frontVowels ) ) {
664 $word = $word . "نەن";
665 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
666 $word = $word . "نان";
671 case "possessive ablative": # täweldık + şığıs
672 if ( in_array( $wordEnding, $firstPerson ) ||
in_array( $wordEnding, $thirdPerson ) ) {
673 if ( in_array( $wordLastVowel, $frontVowels ) ) {
674 $word = $word . "نەن";
675 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
676 $word = $word . "نان";
678 } elseif ( in_array( $wordEnding, $secondPerson ) ) {
679 if ( in_array( $wordLastVowel, $frontVowels ) ) {
680 $word = $word . "دەن";
681 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
682 $word = $word . "دان";
687 case "comitative": # kömektes
688 if ( in_array( $wordEnding, $Consonants ) ) {
689 $word = $word . "پەن";
690 } elseif ( in_array( $wordEnding, $allVowels ) ||
in_array( $wordEnding, $Nasals ) ||
in_array( $wordEnding, $Sonants ) ) {
691 $word = $word . "مەن";
692 } elseif ( in_array( $wordEnding, $Sibilants ) ) {
693 $word = $word . "بەن";
697 case "possessive comitative": # täweldık + kömektes
698 if ( in_array( $wordEnding, $Consonants ) ) {
699 $word = $word . "پەنەن";
700 } elseif ( in_array( $wordEnding, $allVowels ) ||
in_array( $wordEnding, $Nasals ) ||
in_array( $wordEnding, $Sonants ) ) {
701 $word = $word . "مەنەن";
702 } elseif ( in_array( $wordEnding, $Sibilants ) ) {
703 $word = $word . "بەنەن";
706 default: # dc0 #nominative #ataw
712 * @param $word string
713 * @param $allVowels array
716 function lastLetter( $word, $allVowels ) {
717 $lastLetter = array();
719 // Put the word in a form we can play with since we're using UTF-8
720 $ar = preg_split( '//u', parent
::lc( $word ), -1, PREG_SPLIT_NO_EMPTY
);
722 // Here's an array with the order of the letters in the word reversed
723 // so we can find a match quicker *shrug*
724 $wordReversed = array_reverse( $ar );
726 // Here's the last letter in the word
727 $lastLetter[0] = $ar[count( $ar ) - 1];
729 // Find the last vowel in the word
730 $lastLetter[1] = NULL;
731 foreach ( $wordReversed as $xvalue ) {
732 foreach ( $allVowels as $yvalue ) {
733 if ( strcmp( $xvalue, $yvalue ) == 0 ) {
734 $lastLetter[1] = $xvalue;
740 if ( $lastLetter[1] !== NULL ) {
751 * Avoid grouping whole numbers between 0 to 9999
757 function commafy( $_ ) {
758 if ( !preg_match( '/^\d{1,4}$/', $_ ) ) {
759 return strrev( (string)preg_replace( '/(\d{3})(?=\d)(?!\d*\.)/', '$1,', strrev( $_ ) ) );