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