MediaWiki REL1_31
LanguageKk_cyrl.php
Go to the documentation of this file.
1<?php
29// phpcs:ignore Squiz.Classes.ValidClassName.NotCamelCaps
31 # Convert from the nominative form of a noun to some other case
32 # Invoked with {{GRAMMAR:case|word}}
41 function convertGrammarKk_cyrl( $word, $case ) {
43 if ( isset( $wgGrammarForms['kk-kz'][$case][$word] ) ) {
44 return $wgGrammarForms['kk-kz'][$case][$word];
45 }
46 if ( isset( $wgGrammarForms['kk-cyrl'][$case][$word] ) ) {
47 return $wgGrammarForms['kk-cyrl'][$case][$word];
48 }
49 // Set up some constants...
50 // Vowels in last syllable
51 $frontVowels = [ "е", "ө", "ү", "і", "ә", "э", "я", "ё", "и" ];
52 $backVowels = [ "а", "о", "ұ", "ы" ];
53 $allVowels = [ "е", "ө", "ү", "і", "ә", "э", "а", "о", "ұ", "ы", "я", "ё", "и" ];
54 // Preceding letters
55 $Nasals = [ "м", "н", "ң" ];
56 $Sonants = [ "и", "й", "л", "р", "у", "ю" ];
57 $Consonants = [ "п", "ф", "к", "қ", "т", "ш", "с", "х", "ц", "ч", "щ", "б", "в", "г", "д" ];
58 $Sibilants = [ "ж", "з" ];
59 $Sonorants = [ "и", "й", "л", "р", "у", "ю", "м", "н", "ң", "ж", "з" ];
60
61 // Possessives
62 $firstPerson = [ "м", "ң" ]; // 1st singular, 2nd unformal
63 $secondPerson = [ "з" ]; // 1st plural, 2nd formal
64 $thirdPerson = [ "ы", "і" ]; // 3rd
65
66 $lastLetter = $this->lastLetter( $word, $allVowels );
67 $wordEnding =& $lastLetter[0];
68 $wordLastVowel =& $lastLetter[1];
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 = $word . "тің";
77 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
78 $word = $word . "тың";
79 }
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 . "ның";
85 }
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 . "дың";
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 = $word . "ке";
99 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
100 $word = $word . "қа";
101 }
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 . "ға";
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 = $word . "е";
115 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
116 $word = $word . "а";
117 }
118 } elseif ( in_array( $wordEnding, $secondPerson ) ) {
119 if ( in_array( $wordLastVowel, $frontVowels ) ) {
120 $word = $word . "ге";
121 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
122 $word = $word . "ға";
123 }
124 } elseif ( in_array( $wordEnding, $thirdPerson ) ) {
125 if ( in_array( $wordLastVowel, $frontVowels ) ) {
126 $word = $word . "не";
127 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
128 $word = $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 = $word . "ті";
137 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
138 $word = $word . "ты";
139 }
140 } elseif ( in_array( $wordEnding, $allVowels ) ) {
141 if ( in_array( $wordLastVowel, $frontVowels ) ) {
142 $word = $word . "ні";
143 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
144 $word = $word . "ны";
145 }
146 } elseif ( in_array( $wordEnding, $Sonorants ) ) {
147 if ( in_array( $wordLastVowel, $frontVowels ) ) {
148 $word = $word . "ді";
149 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
150 $word = $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 = $word . "ді";
159 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
160 $word = $word . "ды";
161 }
162 } elseif ( in_array( $wordEnding, $thirdPerson ) ) {
163 $word = $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 = $word . "те";
171 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
172 $word = $word . "та";
173 }
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 . "да";
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 = $word . "де";
187 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
188 $word = $word . "да";
189 }
190 } elseif ( in_array( $wordEnding, $thirdPerson ) ) {
191 if ( in_array( $wordLastVowel, $frontVowels ) ) {
192 $word = $word . "нде";
193 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
194 $word = $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 = $word . "тен";
203 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
204 $word = $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 = $word . "ден";
212 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
213 $word = $word . "дан";
214 }
215 } elseif ( in_array( $wordEnding, $Nasals ) ) {
216 if ( in_array( $wordLastVowel, $frontVowels ) ) {
217 $word = $word . "нен";
218 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
219 $word = $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 = $word . "нен";
228 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
229 $word = $word . "нан";
230 }
231 } elseif ( in_array( $wordEnding, $secondPerson ) ) {
232 if ( in_array( $wordLastVowel, $frontVowels ) ) {
233 $word = $word . "ден";
234 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
235 $word = $word . "дан";
236 }
237 }
238 break;
239 case "dc6":
240 case "comitative": # kömektes
241 if ( in_array( $wordEnding, $Consonants ) ) {
242 $word = $word . "пен";
243 } elseif ( in_array( $wordEnding, $allVowels )
244 || in_array( $wordEnding, $Nasals )
245 || in_array( $wordEnding, $Sonants )
246 ) {
247 $word = $word . "мен";
248 } elseif ( in_array( $wordEnding, $Sibilants ) ) {
249 $word = $word . "бен";
250 }
251 break;
252 case "dc61":
253 case "possessive comitative": # täweldık + kömektes
254 if ( in_array( $wordEnding, $Consonants ) ) {
255 $word = $word . "пенен";
256 } elseif ( in_array( $wordEnding, $allVowels )
257 || in_array( $wordEnding, $Nasals )
258 || in_array( $wordEnding, $Sonants )
259 ) {
260 $word = $word . "менен";
261 } elseif ( in_array( $wordEnding, $Sibilants ) ) {
262 $word = $word . "бенен";
263 }
264 break;
265 default: # dc0 #nominative #ataw
266 }
267 return $word;
268 }
269
275 function convertGrammarKk_latn( $word, $case ) {
277 if ( isset( $wgGrammarForms['kk-tr'][$case][$word] ) ) {
278 return $wgGrammarForms['kk-tr'][$case][$word];
279 }
280 if ( isset( $wgGrammarForms['kk-latn'][$case][$word] ) ) {
281 return $wgGrammarForms['kk-latn'][$case][$word];
282 }
283 // Set up some constants...
284 // Vowels in last syllable
285 $frontVowels = [ "e", "ö", "ü", "i", "ä", "é" ];
286 $backVowels = [ "a", "o", "u", "ı" ];
287 $allVowels = [ "e", "ö", "ü", "i", "ä", "é", "a", "o", "u", "ı" ];
288 // Preceding letters
289 $Nasals = [ "m", "n", "ñ" ];
290 $Sonants = [ "ï", "y", "ý", "l", "r", "w" ];
291 $Consonants = [ "p", "f", "k", "q", "t", "ş", "s", "x", "c", "ç", "b", "v", "g", "d" ];
292 $Sibilants = [ "j", "z" ];
293 $Sonorants = [ "ï", "y", "ý", "l", "r", "w", "m", "n", "ñ", "j", "z" ];
294
295 // Possessives
296 $firstPerson = [ "m", "ñ" ]; // 1st singular, 2nd unformal
297 $secondPerson = [ "z" ]; // 1st plural, 2nd formal
298 $thirdPerson = [ "ı", "i" ]; // 3rd
299
300 $lastLetter = $this->lastLetter( $word, $allVowels );
301 $wordEnding =& $lastLetter[0];
302 $wordLastVowel =& $lastLetter[1];
303
304 // Now convert the word
305 switch ( $case ) {
306 case "dc1":
307 case "genitive": # ilik
308 if ( in_array( $wordEnding, $Consonants ) ) {
309 if ( in_array( $wordLastVowel, $frontVowels ) ) {
310 $word = $word . "tiñ";
311 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
312 $word = $word . "tıñ";
313 }
314 } elseif ( in_array( $wordEnding, $allVowels ) || in_array( $wordEnding, $Nasals ) ) {
315 if ( in_array( $wordLastVowel, $frontVowels ) ) {
316 $word = $word . "niñ";
317 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
318 $word = $word . "nıñ";
319 }
320 } elseif ( in_array( $wordEnding, $Sonants ) || in_array( $wordEnding, $Sibilants ) ) {
321 if ( in_array( $wordLastVowel, $frontVowels ) ) {
322 $word = $word . "diñ";
323 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
324 $word = $word . "dıñ";
325 }
326 }
327 break;
328 case "dc2":
329 case "dative": # barıs
330 if ( in_array( $wordEnding, $Consonants ) ) {
331 if ( in_array( $wordLastVowel, $frontVowels ) ) {
332 $word = $word . "ke";
333 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
334 $word = $word . "qa";
335 }
336 } elseif ( in_array( $wordEnding, $allVowels ) || in_array( $wordEnding, $Sonorants ) ) {
337 if ( in_array( $wordLastVowel, $frontVowels ) ) {
338 $word = $word . "ge";
339 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
340 $word = $word . "ğa";
341 }
342 }
343 break;
344 case "dc21":
345 case "possessive dative": # täweldık + barıs
346 if ( in_array( $wordEnding, $firstPerson ) ) {
347 if ( in_array( $wordLastVowel, $frontVowels ) ) {
348 $word = $word . "e";
349 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
350 $word = $word . "a";
351 }
352 } elseif ( in_array( $wordEnding, $secondPerson ) ) {
353 if ( in_array( $wordLastVowel, $frontVowels ) ) {
354 $word = $word . "ge";
355 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
356 $word = $word . "ğa";
357 }
358 } elseif ( in_array( $wordEnding, $thirdPerson ) ) {
359 if ( in_array( $wordLastVowel, $frontVowels ) ) {
360 $word = $word . "ne";
361 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
362 $word = $word . "na";
363 }
364 }
365 break;
366 case "dc3":
367 case "accusative": # tabıs
368 if ( in_array( $wordEnding, $Consonants ) ) {
369 if ( in_array( $wordLastVowel, $frontVowels ) ) {
370 $word = $word . "ti";
371 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
372 $word = $word . "tı";
373 }
374 } elseif ( in_array( $wordEnding, $allVowels ) ) {
375 if ( in_array( $wordLastVowel, $frontVowels ) ) {
376 $word = $word . "ni";
377 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
378 $word = $word . "nı";
379 }
380 } elseif ( in_array( $wordEnding, $Sonorants ) ) {
381 if ( in_array( $wordLastVowel, $frontVowels ) ) {
382 $word = $word . "di";
383 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
384 $word = $word . "dı";
385 }
386 }
387 break;
388 case "dc31":
389 case "possessive accusative": # täweldık + tabıs
390 if ( in_array( $wordEnding, $firstPerson ) || in_array( $wordEnding, $secondPerson ) ) {
391 if ( in_array( $wordLastVowel, $frontVowels ) ) {
392 $word = $word . "di";
393 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
394 $word = $word . "dı";
395 }
396 } elseif ( in_array( $wordEnding, $thirdPerson ) ) {
397 $word = $word . "n";
398 }
399 break;
400 case "dc4":
401 case "locative": # jatıs
402 if ( in_array( $wordEnding, $Consonants ) ) {
403 if ( in_array( $wordLastVowel, $frontVowels ) ) {
404 $word = $word . "te";
405 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
406 $word = $word . "ta";
407 }
408 } elseif ( in_array( $wordEnding, $allVowels ) || in_array( $wordEnding, $Sonorants ) ) {
409 if ( in_array( $wordLastVowel, $frontVowels ) ) {
410 $word = $word . "de";
411 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
412 $word = $word . "da";
413 }
414 }
415 break;
416 case "dc41":
417 case "possessive locative": # täweldık + jatıs
418 if ( in_array( $wordEnding, $firstPerson ) || in_array( $wordEnding, $secondPerson ) ) {
419 if ( in_array( $wordLastVowel, $frontVowels ) ) {
420 $word = $word . "de";
421 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
422 $word = $word . "da";
423 }
424 } elseif ( in_array( $wordEnding, $thirdPerson ) ) {
425 if ( in_array( $wordLastVowel, $frontVowels ) ) {
426 $word = $word . "nde";
427 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
428 $word = $word . "nda";
429 }
430 }
431 break;
432 case "dc5":
433 case "ablative": # şığıs
434 if ( in_array( $wordEnding, $Consonants ) ) {
435 if ( in_array( $wordLastVowel, $frontVowels ) ) {
436 $word = $word . "ten";
437 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
438 $word = $word . "tan";
439 }
440 } elseif ( in_array( $wordEnding, $allVowels )
441 || in_array( $wordEnding, $Sonants )
442 || in_array( $wordEnding, $Sibilants )
443 ) {
444 if ( in_array( $wordLastVowel, $frontVowels ) ) {
445 $word = $word . "den";
446 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
447 $word = $word . "dan";
448 }
449 } elseif ( in_array( $wordEnding, $Nasals ) ) {
450 if ( in_array( $wordLastVowel, $frontVowels ) ) {
451 $word = $word . "nen";
452 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
453 $word = $word . "nan";
454 }
455 }
456 break;
457 case "dc51":
458 case "possessive ablative": # täweldık + şığıs
459 if ( in_array( $wordEnding, $firstPerson ) || in_array( $wordEnding, $thirdPerson ) ) {
460 if ( in_array( $wordLastVowel, $frontVowels ) ) {
461 $word = $word . "nen";
462 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
463 $word = $word . "nan";
464 }
465 } elseif ( in_array( $wordEnding, $secondPerson ) ) {
466 if ( in_array( $wordLastVowel, $frontVowels ) ) {
467 $word = $word . "den";
468 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
469 $word = $word . "dan";
470 }
471 }
472 break;
473 case "dc6":
474 case "comitative": # kömektes
475 if ( in_array( $wordEnding, $Consonants ) ) {
476 $word = $word . "pen";
477 } elseif ( in_array( $wordEnding, $allVowels )
478 || in_array( $wordEnding, $Nasals )
479 || in_array( $wordEnding, $Sonants )
480 ) {
481 $word = $word . "men";
482 } elseif ( in_array( $wordEnding, $Sibilants ) ) {
483 $word = $word . "ben";
484 }
485 break;
486 case "dc61":
487 case "possessive comitative": # täweldık + kömektes
488 if ( in_array( $wordEnding, $Consonants ) ) {
489 $word = $word . "penen";
490 } elseif ( in_array( $wordEnding, $allVowels )
491 || in_array( $wordEnding, $Nasals )
492 || in_array( $wordEnding, $Sonants )
493 ) {
494 $word = $word . "menen";
495 } elseif ( in_array( $wordEnding, $Sibilants ) ) {
496 $word = $word . "benen";
497 }
498 break;
499 default: # dc0 #nominative #ataw
500 }
501 return $word;
502 }
503
509 function convertGrammarKk_arab( $word, $case ) {
511 if ( isset( $wgGrammarForms['kk-cn'][$case][$word] ) ) {
512 return $wgGrammarForms['kk-cn'][$case][$word];
513 }
514 if ( isset( $wgGrammarForms['kk-arab'][$case][$word] ) ) {
515 return $wgGrammarForms['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 $lastLetter = $this->lastLetter( $word, $allVowels );
535 $wordEnding = $lastLetter[0];
536 $wordLastVowel = $lastLetter[1];
537
538 // Now convert the word
539 switch ( $case ) {
540 case "dc1":
541 case "genitive": # ilik
542 if ( in_array( $wordEnding, $Consonants ) ) {
543 if ( in_array( $wordLastVowel, $frontVowels ) ) {
544 $word = $word . "تٸڭ";
545 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
546 $word = $word . "تىڭ";
547 }
548 } elseif ( in_array( $wordEnding, $allVowels ) || in_array( $wordEnding, $Nasals ) ) {
549 if ( in_array( $wordLastVowel, $frontVowels ) ) {
550 $word = $word . "نٸڭ";
551 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
552 $word = $word . "نىڭ";
553 }
554 } elseif ( in_array( $wordEnding, $Sonants ) || in_array( $wordEnding, $Sibilants ) ) {
555 if ( in_array( $wordLastVowel, $frontVowels ) ) {
556 $word = $word . "دٸڭ";
557 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
558 $word = $word . "دىڭ";
559 }
560 }
561 break;
562 case "dc2":
563 case "dative": # barıs
564 if ( in_array( $wordEnding, $Consonants ) ) {
565 if ( in_array( $wordLastVowel, $frontVowels ) ) {
566 $word = $word . "كە";
567 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
568 $word = $word . "قا";
569 }
570 } elseif ( in_array( $wordEnding, $allVowels ) || in_array( $wordEnding, $Sonorants ) ) {
571 if ( in_array( $wordLastVowel, $frontVowels ) ) {
572 $word = $word . "گە";
573 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
574 $word = $word . "عا";
575 }
576 }
577 break;
578 case "dc21":
579 case "possessive dative": # täweldık + barıs
580 if ( in_array( $wordEnding, $firstPerson ) ) {
581 if ( in_array( $wordLastVowel, $frontVowels ) ) {
582 $word = $word . "ە";
583 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
584 $word = $word . "ا";
585 }
586 } elseif ( in_array( $wordEnding, $secondPerson ) ) {
587 if ( in_array( $wordLastVowel, $frontVowels ) ) {
588 $word = $word . "گە";
589 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
590 $word = $word . "عا";
591 }
592 } elseif ( in_array( $wordEnding, $thirdPerson ) ) {
593 if ( in_array( $wordLastVowel, $frontVowels ) ) {
594 $word = $word . "نە";
595 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
596 $word = $word . "نا";
597 }
598 }
599 break;
600 case "dc3":
601 case "accusative": # tabıs
602 if ( in_array( $wordEnding, $Consonants ) ) {
603 if ( in_array( $wordLastVowel, $frontVowels ) ) {
604 $word = $word . "تٸ";
605 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
606 $word = $word . "تى";
607 }
608 } elseif ( in_array( $wordEnding, $allVowels ) ) {
609 if ( in_array( $wordLastVowel, $frontVowels ) ) {
610 $word = $word . "نٸ";
611 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
612 $word = $word . "نى";
613 }
614 } elseif ( in_array( $wordEnding, $Sonorants ) ) {
615 if ( in_array( $wordLastVowel, $frontVowels ) ) {
616 $word = $word . "دٸ";
617 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
618 $word = $word . "دى";
619 }
620 }
621 break;
622 case "dc31":
623 case "possessive accusative": # täweldık + tabıs
624 if ( in_array( $wordEnding, $firstPerson ) || in_array( $wordEnding, $secondPerson ) ) {
625 if ( in_array( $wordLastVowel, $frontVowels ) ) {
626 $word = $word . "دٸ";
627 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
628 $word = $word . "دى";
629 }
630 } elseif ( in_array( $wordEnding, $thirdPerson ) ) {
631 $word = $word . "ن";
632 }
633 break;
634 case "dc4":
635 case "locative": # jatıs
636 if ( in_array( $wordEnding, $Consonants ) ) {
637 if ( in_array( $wordLastVowel, $frontVowels ) ) {
638 $word = $word . "تە";
639 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
640 $word = $word . "تا";
641 }
642 } elseif ( in_array( $wordEnding, $allVowels ) || in_array( $wordEnding, $Sonorants ) ) {
643 if ( in_array( $wordLastVowel, $frontVowels ) ) {
644 $word = $word . "دە";
645 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
646 $word = $word . "دا";
647 }
648 }
649 break;
650 case "dc41":
651 case "possessive locative": # täweldık + jatıs
652 if ( in_array( $wordEnding, $firstPerson ) || in_array( $wordEnding, $secondPerson ) ) {
653 if ( in_array( $wordLastVowel, $frontVowels ) ) {
654 $word = $word . "دە";
655 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
656 $word = $word . "دا";
657 }
658 } elseif ( in_array( $wordEnding, $thirdPerson ) ) {
659 if ( in_array( $wordLastVowel, $frontVowels ) ) {
660 $word = $word . "ندە";
661 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
662 $word = $word . "ندا";
663 }
664 }
665 break;
666 case "dc5":
667 case "ablative": # şığıs
668 if ( in_array( $wordEnding, $Consonants ) ) {
669 if ( in_array( $wordLastVowel, $frontVowels ) ) {
670 $word = $word . "تەن";
671 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
672 $word = $word . "تان";
673 }
674 } elseif ( in_array( $wordEnding, $allVowels )
675 || in_array( $wordEnding, $Sonants )
676 || in_array( $wordEnding, $Sibilants )
677 ) {
678 if ( in_array( $wordLastVowel, $frontVowels ) ) {
679 $word = $word . "دەن";
680 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
681 $word = $word . "دان";
682 }
683 } elseif ( in_array( $wordEnding, $Nasals ) ) {
684 if ( in_array( $wordLastVowel, $frontVowels ) ) {
685 $word = $word . "نەن";
686 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
687 $word = $word . "نان";
688 }
689 }
690 break;
691 case "dc51":
692 case "possessive ablative": # täweldık + şığıs
693 if ( in_array( $wordEnding, $firstPerson ) || in_array( $wordEnding, $thirdPerson ) ) {
694 if ( in_array( $wordLastVowel, $frontVowels ) ) {
695 $word = $word . "نەن";
696 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
697 $word = $word . "نان";
698 }
699 } elseif ( in_array( $wordEnding, $secondPerson ) ) {
700 if ( in_array( $wordLastVowel, $frontVowels ) ) {
701 $word = $word . "دەن";
702 } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
703 $word = $word . "دان";
704 }
705 }
706 break;
707 case "dc6":
708 case "comitative": # kömektes
709 if ( in_array( $wordEnding, $Consonants ) ) {
710 $word = $word . "پەن";
711 } elseif ( in_array( $wordEnding, $allVowels )
712 || in_array( $wordEnding, $Nasals )
713 || in_array( $wordEnding, $Sonants )
714 ) {
715 $word = $word . "مەن";
716 } elseif ( in_array( $wordEnding, $Sibilants ) ) {
717 $word = $word . "بەن";
718 }
719 break;
720 case "dc61":
721 case "possessive comitative": # täweldık + kömektes
722 if ( in_array( $wordEnding, $Consonants ) ) {
723 $word = $word . "پەنەن";
724 } elseif ( in_array( $wordEnding, $allVowels )
725 || in_array( $wordEnding, $Nasals )
726 || in_array( $wordEnding, $Sonants )
727 ) {
728 $word = $word . "مەنەن";
729 } elseif ( in_array( $wordEnding, $Sibilants ) ) {
730 $word = $word . "بەنەن";
731 }
732 break;
733 default: # dc0 #nominative #ataw
734 }
735 return $word;
736 }
737
743 function lastLetter( $word, $allVowels ) {
744 $lastLetter = [];
745
746 // Put the word in a form we can play with since we're using UTF-8
747 $ar = preg_split( '//u', parent::lc( $word ), -1, PREG_SPLIT_NO_EMPTY );
748
749 // Here's an array with the order of the letters in the word reversed
750 // so we can find a match quicker *shrug*
751 $wordReversed = array_reverse( $ar );
752
753 // Here's the last letter in the word
754 $lastLetter[0] = $ar[count( $ar ) - 1];
755
756 // Find the last vowel in the word
757 $lastLetter[1] = null;
758 foreach ( $wordReversed as $xvalue ) {
759 foreach ( $allVowels as $yvalue ) {
760 if ( strcmp( $xvalue, $yvalue ) == 0 ) {
761 $lastLetter[1] = $xvalue;
762 break;
763 } else {
764 continue;
765 }
766 }
767 if ( $lastLetter[1] !== null ) {
768 break;
769 } else {
770 continue;
771 }
772 }
773
774 return $lastLetter;
775 }
776}
$wgGrammarForms
Some languages need different word forms, usually for different cases.
Kazakh (Қазақша)
convertGrammarKk_arab( $word, $case)
convertGrammarKk_cyrl( $word, $case)
Cases: genitive, dative, accusative, locative, ablative, comitative + possessive forms.
convertGrammarKk_latn( $word, $case)
lastLetter( $word, $allVowels)
Internationalisation code.
Definition Language.php:35
when a variable name is used in a it is silently declared as a new local masking the global
Definition design.txt:95
This document is intended to provide useful advice for parties seeking to redistribute MediaWiki to end users It s targeted particularly at maintainers for Linux since it s been observed that distribution packages of MediaWiki often break We ve consistently had to recommend that users seeking support use official tarballs instead of their distribution s and this often solves whatever problem the user is having It would be nice if this could such as
injection txt This is an overview of how MediaWiki makes use of dependency injection The design described here grew from the discussion of RFC T384 The term dependency this means that anything an object needs to operate should be injected from the the object itself should only know narrow no concrete implementation of the logic it relies on The requirement to inject everything typically results in an architecture that based on two main types of and essentially stateless service objects that use other service objects to operate on the value objects As of the beginning MediaWiki is only starting to use the DI approach Much of the code still relies on global state or direct resulting in a highly cyclical dependency which acts as the top level factory for services in MediaWiki which can be used to gain access to default instances of various services MediaWikiServices however also allows new services to be defined and default services to be redefined Services are defined or redefined by providing a callback the instantiator that will return a new instance of the service When it will create an instance of MediaWikiServices and populate it with the services defined in the files listed by thereby bootstrapping the DI framework Per $wgServiceWiringFiles lists includes ServiceWiring php
Definition injection.txt:37