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