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