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