MediaWiki  REL1_24
LanguageKk_cyrl.php
Go to the documentation of this file.
00001 <?php
00029 // @codingStandardsIgnoreStart Ignore class name is not in camel caps format error
00030 class LanguageKk_cyrl extends Language {
00031     // @codingStandardsIgnoreEnd
00032     # Convert from the nominative form of a noun to some other case
00033     # Invoked with {{GRAMMAR:case|word}}
00034 
00042     function convertGrammarKk_cyrl( $word, $case ) {
00043         global $wgGrammarForms;
00044         if ( isset( $wgGrammarForms['kk-kz'][$case][$word] ) ) {
00045             return $wgGrammarForms['kk-kz'][$case][$word];
00046         }
00047         if ( isset( $wgGrammarForms['kk-cyrl'][$case][$word] ) ) {
00048             return $wgGrammarForms['kk-cyrl'][$case][$word];
00049         }
00050         // Set up some constants...
00051         // Vowels in last syllable
00052         $frontVowels = array( "е", "ө", "ү", "і", "ә", "э", "я", "ё", "и" );
00053         $backVowels = array( "а", "о", "ұ", "ы" );
00054         $allVowels = array( "е", "ө", "ү", "і", "ә", "э", "а", "о", "ұ", "ы", "я", "ё", "и" );
00055         // Preceding letters
00056         $Nasals = array( "м", "н", "ң" );
00057         $Sonants = array( "и", "й", "л", "р", "у", "ю" );
00058         $Consonants = array( "п", "ф", "к", "қ", "т", "ш", "с", "х", "ц", "ч", "щ", "б", "в", "г", "д" );
00059         $Sibilants = array( "ж", "з" );
00060         $Sonorants = array( "и", "й", "л", "р", "у", "ю", "м", "н", "ң", "ж", "з" );
00061 
00062         // Possessives
00063         $firstPerson = array( "м", "ң" ); // 1st singular, 2nd unformal
00064         $secondPerson = array( "з" ); // 1st plural, 2nd formal
00065         $thirdPerson = array( "ы", "і" ); // 3rd
00066 
00067         $lastLetter = $this->lastLetter( $word, $allVowels );
00068         $wordEnding =& $lastLetter[0];
00069         $wordLastVowel =& $lastLetter[1];
00070 
00071         // Now convert the word
00072         switch ( $case ) {
00073             case "dc1":
00074             case "genitive": # ilik
00075                 if ( in_array( $wordEnding, $Consonants ) ) {
00076                     if ( in_array( $wordLastVowel, $frontVowels ) ) {
00077                         $word = $word . "тің";
00078                     } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
00079                         $word = $word . "тың";
00080                     }
00081                 } elseif ( in_array( $wordEnding, $allVowels ) || in_array( $wordEnding, $Nasals ) ) {
00082                     if ( in_array( $wordLastVowel, $frontVowels ) ) {
00083                         $word = $word . "нің";
00084                     } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
00085                         $word = $word . "ның";
00086                     }
00087                 } elseif ( in_array( $wordEnding, $Sonants ) || in_array( $wordEnding, $Sibilants ) ) {
00088                     if ( in_array( $wordLastVowel, $frontVowels ) ) {
00089                         $word = $word . "дің";
00090                     } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
00091                         $word = $word . "дың";
00092                     }
00093                 }
00094                 break;
00095             case "dc2":
00096             case "dative": # barıs
00097                 if ( in_array( $wordEnding, $Consonants ) ) {
00098                     if ( in_array( $wordLastVowel, $frontVowels ) ) {
00099                         $word = $word . "ке";
00100                     } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
00101                         $word = $word . "қа";
00102                     }
00103                 } elseif ( in_array( $wordEnding, $allVowels ) || in_array( $wordEnding, $Sonorants ) ) {
00104                     if ( in_array( $wordLastVowel, $frontVowels ) ) {
00105                         $word = $word . "ге";
00106                     } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
00107                         $word = $word . "ға";
00108                     }
00109                 }
00110                 break;
00111             case "dc21":
00112             case "possessive dative": # täweldık + barıs
00113                 if ( in_array( $wordEnding, $firstPerson ) ) {
00114                     if ( in_array( $wordLastVowel, $frontVowels ) ) {
00115                         $word = $word . "е";
00116                     } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
00117                         $word = $word . "а";
00118                     }
00119                 } elseif ( in_array( $wordEnding, $secondPerson ) ) {
00120                     if ( in_array( $wordLastVowel, $frontVowels ) ) {
00121                         $word = $word . "ге";
00122                     } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
00123                         $word = $word . "ға";
00124                     }
00125                 } elseif ( in_array( $wordEnding, $thirdPerson ) ) {
00126                     if ( in_array( $wordLastVowel, $frontVowels ) ) {
00127                         $word = $word . "не";
00128                     } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
00129                         $word = $word . "на";
00130                     }
00131                 }
00132                 break;
00133             case "dc3":
00134             case "accusative": # tabıs
00135                 if ( in_array( $wordEnding, $Consonants ) ) {
00136                     if ( in_array( $wordLastVowel, $frontVowels ) ) {
00137                         $word = $word . "ті";
00138                     } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
00139                         $word = $word . "ты";
00140                     }
00141                 } elseif ( in_array( $wordEnding, $allVowels ) ) {
00142                     if ( in_array( $wordLastVowel, $frontVowels ) ) {
00143                         $word = $word . "ні";
00144                     } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
00145                         $word = $word . "ны";
00146                     }
00147                 } elseif ( in_array( $wordEnding, $Sonorants ) ) {
00148                     if ( in_array( $wordLastVowel, $frontVowels ) ) {
00149                         $word = $word . "ді";
00150                     } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
00151                         $word = $word . "ды";
00152                     }
00153                 }
00154                 break;
00155             case "dc31":
00156             case "possessive accusative": # täweldık + tabıs
00157                 if ( in_array( $wordEnding, $firstPerson ) || in_array( $wordEnding, $secondPerson ) ) {
00158                     if ( in_array( $wordLastVowel, $frontVowels ) ) {
00159                         $word = $word . "ді";
00160                     } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
00161                         $word = $word . "ды";
00162                     }
00163                 } elseif ( in_array( $wordEnding, $thirdPerson ) ) {
00164                         $word = $word . "н";
00165                 }
00166                 break;
00167             case "dc4":
00168             case "locative": # jatıs
00169                 if ( in_array( $wordEnding, $Consonants ) ) {
00170                     if ( in_array( $wordLastVowel, $frontVowels ) ) {
00171                         $word = $word . "те";
00172                     } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
00173                         $word = $word . "та";
00174                     }
00175                 } elseif ( in_array( $wordEnding, $allVowels ) || in_array( $wordEnding, $Sonorants ) ) {
00176                     if ( in_array( $wordLastVowel, $frontVowels ) ) {
00177                         $word = $word . "де";
00178                     } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
00179                         $word = $word . "да";
00180                     }
00181                 }
00182                 break;
00183             case "dc41":
00184             case "possessive locative": # täweldık + jatıs
00185                 if ( in_array( $wordEnding, $firstPerson ) || in_array( $wordEnding, $secondPerson ) ) {
00186                     if ( in_array( $wordLastVowel, $frontVowels ) ) {
00187                         $word = $word . "де";
00188                     } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
00189                         $word = $word . "да";
00190                     }
00191                 } elseif ( in_array( $wordEnding, $thirdPerson ) ) {
00192                     if ( in_array( $wordLastVowel, $frontVowels ) ) {
00193                         $word = $word . "нде";
00194                     } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
00195                         $word = $word . "нда";
00196                     }
00197                 }
00198                 break;
00199             case "dc5":
00200             case "ablative": # şığıs
00201                 if ( in_array( $wordEnding, $Consonants ) ) {
00202                     if ( in_array( $wordLastVowel, $frontVowels ) ) {
00203                         $word = $word . "тен";
00204                     } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
00205                         $word = $word . "тан";
00206                     }
00207                 } elseif ( in_array( $wordEnding, $allVowels )
00208                     || in_array( $wordEnding, $Sonants )
00209                     || in_array( $wordEnding, $Sibilants )
00210                 ) {
00211                     if ( in_array( $wordLastVowel, $frontVowels ) ) {
00212                         $word = $word . "ден";
00213                     } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
00214                         $word = $word . "дан";
00215                     }
00216                 } elseif ( in_array( $wordEnding, $Nasals ) ) {
00217                     if ( in_array( $wordLastVowel, $frontVowels ) ) {
00218                         $word = $word . "нен";
00219                     } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
00220                         $word = $word . "нан";
00221                     }
00222                 }
00223                 break;
00224             case "dc51":
00225             case "possessive ablative": # täweldık + şığıs
00226                 if ( in_array( $wordEnding, $firstPerson ) || in_array( $wordEnding, $thirdPerson ) ) {
00227                     if ( in_array( $wordLastVowel, $frontVowels ) ) {
00228                         $word = $word . "нен";
00229                     } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
00230                         $word = $word . "нан";
00231                     }
00232                 } elseif ( in_array( $wordEnding, $secondPerson ) ) {
00233                     if ( in_array( $wordLastVowel, $frontVowels ) ) {
00234                         $word = $word . "ден";
00235                     } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
00236                         $word = $word . "дан";
00237                     }
00238                 }
00239                 break;
00240             case "dc6":
00241             case "comitative": # kömektes
00242                 if ( in_array( $wordEnding, $Consonants ) ) {
00243                         $word = $word . "пен";
00244                 } elseif ( in_array( $wordEnding, $allVowels )
00245                     || in_array( $wordEnding, $Nasals )
00246                     || in_array( $wordEnding, $Sonants )
00247                 ) {
00248                         $word = $word . "мен";
00249                 } elseif ( in_array( $wordEnding, $Sibilants ) ) {
00250                         $word = $word . "бен";
00251                 }
00252                 break;
00253             case "dc61":
00254             case "possessive comitative": # täweldık + kömektes
00255                 if ( in_array( $wordEnding, $Consonants ) ) {
00256                         $word = $word . "пенен";
00257                 } elseif ( in_array( $wordEnding, $allVowels )
00258                     || in_array( $wordEnding, $Nasals )
00259                     || in_array( $wordEnding, $Sonants )
00260                 ) {
00261                         $word = $word . "менен";
00262                 } elseif ( in_array( $wordEnding, $Sibilants ) ) {
00263                         $word = $word . "бенен";
00264                 }
00265                 break;
00266             default: # dc0 #nominative #ataw
00267         }
00268         return $word;
00269     }
00270 
00276     function convertGrammarKk_latn( $word, $case ) {
00277         global $wgGrammarForms;
00278         if ( isset( $wgGrammarForms['kk-tr'][$case][$word] ) ) {
00279             return $wgGrammarForms['kk-tr'][$case][$word];
00280         }
00281         if ( isset( $wgGrammarForms['kk-latn'][$case][$word] ) ) {
00282             return $wgGrammarForms['kk-latn'][$case][$word];
00283         }
00284         // Set up some constants...
00285         // Vowels in last syllable
00286         $frontVowels = array( "e", "ö", "ü", "i", "ä", "é" );
00287         $backVowels = array( "a", "o", "u", "ı" );
00288         $allVowels = array( "e", "ö", "ü", "i", "ä", "é", "a", "o", "u", "ı" );
00289         // Preceding letters
00290         $Nasals = array( "m", "n", "ñ" );
00291         $Sonants = array( "ï", "y", "ý", "l", "r", "w" );
00292         $Consonants = array( "p", "f", "k", "q", "t", "ş", "s", "x", "c", "ç", "b", "v", "g", "d" );
00293         $Sibilants = array( "j", "z" );
00294         $Sonorants = array( "ï", "y", "ý", "l", "r", "w", "m", "n", "ñ", "j", "z" );
00295 
00296         // Possessives
00297         $firstPerson = array( "m", "ñ" ); // 1st singular, 2nd unformal
00298         $secondPerson = array( "z" ); // 1st plural, 2nd formal
00299         $thirdPerson = array( "ı", "i" ); // 3rd
00300 
00301         $lastLetter = $this->lastLetter( $word, $allVowels );
00302         $wordEnding =& $lastLetter[0];
00303         $wordLastVowel =& $lastLetter[1];
00304 
00305         // Now convert the word
00306         switch ( $case ) {
00307             case "dc1":
00308             case "genitive": # ilik
00309                 if ( in_array( $wordEnding, $Consonants ) ) {
00310                     if ( in_array( $wordLastVowel, $frontVowels ) ) {
00311                         $word = $word . "tiñ";
00312                     } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
00313                         $word = $word . "tıñ";
00314                     }
00315                 } elseif ( in_array( $wordEnding, $allVowels ) || in_array( $wordEnding, $Nasals ) ) {
00316                     if ( in_array( $wordLastVowel, $frontVowels ) ) {
00317                         $word = $word . "niñ";
00318                     } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
00319                         $word = $word . "nıñ";
00320                     }
00321                 } elseif ( in_array( $wordEnding, $Sonants ) || in_array( $wordEnding, $Sibilants ) ) {
00322                     if ( in_array( $wordLastVowel, $frontVowels ) ) {
00323                         $word = $word . "diñ";
00324                     } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
00325                         $word = $word . "dıñ";
00326                     }
00327                 }
00328                 break;
00329             case "dc2":
00330             case "dative": # barıs
00331                 if ( in_array( $wordEnding, $Consonants ) ) {
00332                     if ( in_array( $wordLastVowel, $frontVowels ) ) {
00333                         $word = $word . "ke";
00334                     } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
00335                         $word = $word . "qa";
00336                     }
00337                 } elseif ( in_array( $wordEnding, $allVowels ) || in_array( $wordEnding, $Sonorants ) ) {
00338                     if ( in_array( $wordLastVowel, $frontVowels ) ) {
00339                         $word = $word . "ge";
00340                     } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
00341                         $word = $word . "ğa";
00342                     }
00343                 }
00344                 break;
00345             case "dc21":
00346             case "possessive dative": # täweldık + barıs
00347                 if ( in_array( $wordEnding, $firstPerson ) ) {
00348                     if ( in_array( $wordLastVowel, $frontVowels ) ) {
00349                         $word = $word . "e";
00350                     } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
00351                         $word = $word . "a";
00352                     }
00353                 } elseif ( in_array( $wordEnding, $secondPerson ) ) {
00354                     if ( in_array( $wordLastVowel, $frontVowels ) ) {
00355                         $word = $word . "ge";
00356                     } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
00357                         $word = $word . "ğa";
00358                     }
00359                 } elseif ( in_array( $wordEnding, $thirdPerson ) ) {
00360                     if ( in_array( $wordLastVowel, $frontVowels ) ) {
00361                         $word = $word . "ne";
00362                     } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
00363                         $word = $word . "na";
00364                     }
00365                 }
00366                 break;
00367             case "dc3":
00368             case "accusative": # tabıs
00369                 if ( in_array( $wordEnding, $Consonants ) ) {
00370                     if ( in_array( $wordLastVowel, $frontVowels ) ) {
00371                         $word = $word . "ti";
00372                     } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
00373                         $word = $word . "tı";
00374                     }
00375                 } elseif ( in_array( $wordEnding, $allVowels ) ) {
00376                     if ( in_array( $wordLastVowel, $frontVowels ) ) {
00377                         $word = $word . "ni";
00378                     } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
00379                         $word = $word . "nı";
00380                     }
00381                 } elseif ( in_array( $wordEnding, $Sonorants ) ) {
00382                     if ( in_array( $wordLastVowel, $frontVowels ) ) {
00383                         $word = $word . "di";
00384                     } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
00385                         $word = $word . "dı";
00386                     }
00387                 }
00388                 break;
00389             case "dc31":
00390             case "possessive accusative": # täweldık + tabıs
00391                 if ( in_array( $wordEnding, $firstPerson ) || in_array( $wordEnding, $secondPerson ) ) {
00392                     if ( in_array( $wordLastVowel, $frontVowels ) ) {
00393                         $word = $word . "di";
00394                     } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
00395                         $word = $word . "dı";
00396                     }
00397                 } elseif ( in_array( $wordEnding, $thirdPerson ) ) {
00398                         $word = $word . "n";
00399                 }
00400                 break;
00401             case "dc4":
00402             case "locative": # jatıs
00403                 if ( in_array( $wordEnding, $Consonants ) ) {
00404                     if ( in_array( $wordLastVowel, $frontVowels ) ) {
00405                         $word = $word . "te";
00406                     } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
00407                         $word = $word . "ta";
00408                     }
00409                 } elseif ( in_array( $wordEnding, $allVowels ) || in_array( $wordEnding, $Sonorants ) ) {
00410                     if ( in_array( $wordLastVowel, $frontVowels ) ) {
00411                         $word = $word . "de";
00412                     } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
00413                         $word = $word . "da";
00414                     }
00415                 }
00416                 break;
00417             case "dc41":
00418             case "possessive locative": # täweldık + jatıs
00419                 if ( in_array( $wordEnding, $firstPerson ) || in_array( $wordEnding, $secondPerson ) ) {
00420                     if ( in_array( $wordLastVowel, $frontVowels ) ) {
00421                         $word = $word . "de";
00422                     } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
00423                         $word = $word . "da";
00424                     }
00425                 } elseif ( in_array( $wordEnding, $thirdPerson ) ) {
00426                     if ( in_array( $wordLastVowel, $frontVowels ) ) {
00427                         $word = $word . "nde";
00428                     } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
00429                         $word = $word . "nda";
00430                     }
00431                 }
00432                 break;
00433             case "dc5":
00434             case "ablative": # şığıs
00435                 if ( in_array( $wordEnding, $Consonants ) ) {
00436                     if ( in_array( $wordLastVowel, $frontVowels ) ) {
00437                         $word = $word . "ten";
00438                     } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
00439                         $word = $word . "tan";
00440                     }
00441                 } elseif ( in_array( $wordEnding, $allVowels )
00442                     || in_array( $wordEnding, $Sonants )
00443                     || in_array( $wordEnding, $Sibilants )
00444                 ) {
00445                     if ( in_array( $wordLastVowel, $frontVowels ) ) {
00446                         $word = $word . "den";
00447                     } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
00448                         $word = $word . "dan";
00449                     }
00450                 } elseif ( in_array( $wordEnding, $Nasals ) ) {
00451                     if ( in_array( $wordLastVowel, $frontVowels ) ) {
00452                         $word = $word . "nen";
00453                     } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
00454                         $word = $word . "nan";
00455                     }
00456                 }
00457                 break;
00458             case "dc51":
00459             case "possessive ablative": # täweldık + şığıs
00460                 if ( in_array( $wordEnding, $firstPerson ) || in_array( $wordEnding, $thirdPerson ) ) {
00461                     if ( in_array( $wordLastVowel, $frontVowels ) ) {
00462                         $word = $word . "nen";
00463                     } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
00464                         $word = $word . "nan";
00465                     }
00466                 } elseif ( in_array( $wordEnding, $secondPerson ) ) {
00467                     if ( in_array( $wordLastVowel, $frontVowels ) ) {
00468                         $word = $word . "den";
00469                     } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
00470                         $word = $word . "dan";
00471                     }
00472                 }
00473                 break;
00474             case "dc6":
00475             case "comitative": # kömektes
00476                 if ( in_array( $wordEnding, $Consonants ) ) {
00477                         $word = $word . "pen";
00478                 } elseif ( in_array( $wordEnding, $allVowels )
00479                     || in_array( $wordEnding, $Nasals )
00480                     || in_array( $wordEnding, $Sonants )
00481                 ) {
00482                         $word = $word . "men";
00483                 } elseif ( in_array( $wordEnding, $Sibilants ) ) {
00484                         $word = $word . "ben";
00485                 }
00486                 break;
00487             case "dc61":
00488             case "possessive comitative": # täweldık + kömektes
00489                 if ( in_array( $wordEnding, $Consonants ) ) {
00490                         $word = $word . "penen";
00491                 } elseif ( in_array( $wordEnding, $allVowels )
00492                     || in_array( $wordEnding, $Nasals )
00493                     || in_array( $wordEnding, $Sonants )
00494                 ) {
00495                         $word = $word . "menen";
00496                 } elseif ( in_array( $wordEnding, $Sibilants ) ) {
00497                         $word = $word . "benen";
00498                 }
00499                 break;
00500             default: # dc0 #nominative #ataw
00501         }
00502         return $word;
00503     }
00504 
00510     function convertGrammarKk_arab( $word, $case ) {
00511         global $wgGrammarForms;
00512         if ( isset( $wgGrammarForms['kk-cn'][$case][$word] ) ) {
00513             return $wgGrammarForms['kk-cn'][$case][$word];
00514         }
00515         if ( isset( $wgGrammarForms['kk-arab'][$case][$word] ) ) {
00516             return $wgGrammarForms['kk-arab'][$case][$word];
00517         }
00518         // Set up some constants...
00519         // Vowels in last syllable
00520         $frontVowels = array( "ە", "ٶ", "ٷ", "ٸ", "ٵ", "ە" );
00521         $backVowels = array( "ا", "و", "ۇ", "ى" );
00522         $allVowels = array( "ە", "ٶ", "ٷ", "ٸ", "ٵ", "ە", "ا", "و", "ۇ", "ى" );
00523         // Preceding letters
00524         $Nasals = array( "م", "ن", "ڭ" );
00525         $Sonants = array( "ي", "ي", "ل", "ر", "ۋ" );
00526         $Consonants = array( "پ", "ف", "ك", "ق", "ت", "ش", "س", "ح", "تس", "چ", "ب", "ۆ", "گ", "د" );
00527         $Sibilants = array( "ج", "ز" );
00528         $Sonorants = array( "ي", "ي", "ل", "ر", "ۋ", "م", "ن", "ڭ", "ج", "ز" );
00529 
00530         // Possessives
00531         $firstPerson = array( "م", "ڭ" ); // 1st singular, 2nd unformal
00532         $secondPerson = array( "ز" ); // 1st plural, 2nd formal
00533         $thirdPerson = array( "ى", "ٸ" ); // 3rd
00534 
00535         $lastLetter = $this->lastLetter( $word, $allVowels );
00536         $wordEnding = $lastLetter[0];
00537         $wordLastVowel = $lastLetter[1];
00538 
00539         // Now convert the word
00540         switch ( $case ) {
00541             case "dc1":
00542             case "genitive": # ilik
00543                 if ( in_array( $wordEnding, $Consonants ) ) {
00544                     if ( in_array( $wordLastVowel, $frontVowels ) ) {
00545                         $word = $word . "تٸڭ";
00546                     } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
00547                         $word = $word . "تىڭ";
00548                     }
00549                 } elseif ( in_array( $wordEnding, $allVowels ) || in_array( $wordEnding, $Nasals ) ) {
00550                     if ( in_array( $wordLastVowel, $frontVowels ) ) {
00551                         $word = $word . "نٸڭ";
00552                     } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
00553                         $word = $word . "نىڭ";
00554                     }
00555                 } elseif ( in_array( $wordEnding, $Sonants ) || in_array( $wordEnding, $Sibilants ) ) {
00556                     if ( in_array( $wordLastVowel, $frontVowels ) ) {
00557                         $word = $word . "دٸڭ";
00558                     } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
00559                         $word = $word . "دىڭ";
00560                     }
00561                 }
00562                 break;
00563             case "dc2":
00564             case "dative": # barıs
00565                 if ( in_array( $wordEnding, $Consonants ) ) {
00566                     if ( in_array( $wordLastVowel, $frontVowels ) ) {
00567                         $word = $word . "كە";
00568                     } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
00569                         $word = $word . "قا";
00570                     }
00571                 } elseif ( in_array( $wordEnding, $allVowels ) || in_array( $wordEnding, $Sonorants ) ) {
00572                     if ( in_array( $wordLastVowel, $frontVowels ) ) {
00573                         $word = $word . "گە";
00574                     } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
00575                         $word = $word . "عا";
00576                     }
00577                 }
00578                 break;
00579             case "dc21":
00580             case "possessive dative": # täweldık + barıs
00581                 if ( in_array( $wordEnding, $firstPerson ) ) {
00582                     if ( in_array( $wordLastVowel, $frontVowels ) ) {
00583                         $word = $word . "ە";
00584                     } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
00585                         $word = $word . "ا";
00586                     }
00587                 } elseif ( in_array( $wordEnding, $secondPerson ) ) {
00588                     if ( in_array( $wordLastVowel, $frontVowels ) ) {
00589                         $word = $word . "گە";
00590                     } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
00591                         $word = $word . "عا";
00592                     }
00593                 } elseif ( in_array( $wordEnding, $thirdPerson ) ) {
00594                     if ( in_array( $wordLastVowel, $frontVowels ) ) {
00595                         $word = $word . "نە";
00596                     } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
00597                         $word = $word . "نا";
00598                     }
00599                 }
00600                 break;
00601             case "dc3":
00602             case "accusative": # tabıs
00603                 if ( in_array( $wordEnding, $Consonants ) ) {
00604                     if ( in_array( $wordLastVowel, $frontVowels ) ) {
00605                         $word = $word . "تٸ";
00606                     } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
00607                         $word = $word . "تى";
00608                     }
00609                 } elseif ( in_array( $wordEnding, $allVowels ) ) {
00610                     if ( in_array( $wordLastVowel, $frontVowels ) ) {
00611                         $word = $word . "نٸ";
00612                     } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
00613                         $word = $word . "نى";
00614                     }
00615                 } elseif ( in_array( $wordEnding, $Sonorants ) ) {
00616                     if ( in_array( $wordLastVowel, $frontVowels ) ) {
00617                         $word = $word . "دٸ";
00618                     } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
00619                         $word = $word . "دى";
00620                     }
00621                 }
00622                 break;
00623             case "dc31":
00624             case "possessive accusative": # täweldık + tabıs
00625                 if ( in_array( $wordEnding, $firstPerson ) || in_array( $wordEnding, $secondPerson ) ) {
00626                     if ( in_array( $wordLastVowel, $frontVowels ) ) {
00627                         $word = $word . "دٸ";
00628                     } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
00629                         $word = $word . "دى";
00630                     }
00631                 } elseif ( in_array( $wordEnding, $thirdPerson ) ) {
00632                         $word = $word . "ن";
00633                 }
00634                 break;
00635             case "dc4":
00636             case "locative": # jatıs
00637                 if ( in_array( $wordEnding, $Consonants ) ) {
00638                     if ( in_array( $wordLastVowel, $frontVowels ) ) {
00639                         $word = $word . "تە";
00640                     } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
00641                         $word = $word . "تا";
00642                     }
00643                 } elseif ( in_array( $wordEnding, $allVowels ) || in_array( $wordEnding, $Sonorants ) ) {
00644                     if ( in_array( $wordLastVowel, $frontVowels ) ) {
00645                         $word = $word . "دە";
00646                     } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
00647                         $word = $word . "دا";
00648                     }
00649                 }
00650                 break;
00651             case "dc41":
00652             case "possessive locative": # täweldık + jatıs
00653                 if ( in_array( $wordEnding, $firstPerson ) || in_array( $wordEnding, $secondPerson ) ) {
00654                     if ( in_array( $wordLastVowel, $frontVowels ) ) {
00655                         $word = $word . "دە";
00656                     } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
00657                         $word = $word . "دا";
00658                     }
00659                 } elseif ( in_array( $wordEnding, $thirdPerson ) ) {
00660                     if ( in_array( $wordLastVowel, $frontVowels ) ) {
00661                         $word = $word . "ندە";
00662                     } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
00663                         $word = $word . "ندا";
00664                     }
00665                 }
00666                 break;
00667             case "dc5":
00668             case "ablative": # şığıs
00669                 if ( in_array( $wordEnding, $Consonants ) ) {
00670                     if ( in_array( $wordLastVowel, $frontVowels ) ) {
00671                         $word = $word . "تەن";
00672                     } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
00673                         $word = $word . "تان";
00674                     }
00675                 } elseif ( in_array( $wordEnding, $allVowels )
00676                     || in_array( $wordEnding, $Sonants )
00677                     || in_array( $wordEnding, $Sibilants )
00678                 ) {
00679                     if ( in_array( $wordLastVowel, $frontVowels ) ) {
00680                         $word = $word . "دەن";
00681                     } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
00682                         $word = $word . "دان";
00683                     }
00684                 } elseif ( in_array( $wordEnding, $Nasals ) ) {
00685                     if ( in_array( $wordLastVowel, $frontVowels ) ) {
00686                         $word = $word . "نەن";
00687                     } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
00688                         $word = $word . "نان";
00689                     }
00690                 }
00691                 break;
00692             case "dc51":
00693             case "possessive ablative": # täweldık + şığıs
00694                 if ( in_array( $wordEnding, $firstPerson ) || in_array( $wordEnding, $thirdPerson ) ) {
00695                     if ( in_array( $wordLastVowel, $frontVowels ) ) {
00696                         $word = $word . "نەن";
00697                     } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
00698                         $word = $word . "نان";
00699                     }
00700                 } elseif ( in_array( $wordEnding, $secondPerson ) ) {
00701                     if ( in_array( $wordLastVowel, $frontVowels ) ) {
00702                         $word = $word . "دەن";
00703                     } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
00704                         $word = $word . "دان";
00705                     }
00706                 }
00707                 break;
00708             case "dc6":
00709             case "comitative": # kömektes
00710                 if ( in_array( $wordEnding, $Consonants ) ) {
00711                         $word = $word . "پەن";
00712                 } elseif ( in_array( $wordEnding, $allVowels )
00713                     || in_array( $wordEnding, $Nasals )
00714                     || in_array( $wordEnding, $Sonants )
00715                 ) {
00716                         $word = $word . "مەن";
00717                 } elseif ( in_array( $wordEnding, $Sibilants ) ) {
00718                         $word = $word . "بەن";
00719                 }
00720                 break;
00721             case "dc61":
00722             case "possessive comitative": # täweldık + kömektes
00723                 if ( in_array( $wordEnding, $Consonants ) ) {
00724                         $word = $word . "پەنەن";
00725                 } elseif ( in_array( $wordEnding, $allVowels )
00726                     || in_array( $wordEnding, $Nasals )
00727                     || in_array( $wordEnding, $Sonants )
00728                 ) {
00729                         $word = $word . "مەنەن";
00730                 } elseif ( in_array( $wordEnding, $Sibilants ) ) {
00731                         $word = $word . "بەنەن";
00732                 }
00733                 break;
00734             default: # dc0 #nominative #ataw
00735         }
00736         return $word;
00737     }
00738 
00744     function lastLetter( $word, $allVowels ) {
00745         $lastLetter = array();
00746 
00747         // Put the word in a form we can play with since we're using UTF-8
00748         $ar = preg_split( '//u', parent::lc( $word ), -1, PREG_SPLIT_NO_EMPTY );
00749 
00750         // Here's an array with the order of the letters in the word reversed
00751         // so we can find a match quicker *shrug*
00752         $wordReversed = array_reverse( $ar );
00753 
00754         // Here's the last letter in the word
00755         $lastLetter[0] = $ar[count( $ar ) - 1];
00756 
00757         // Find the last vowel in the word
00758         $lastLetter[1] = null;
00759         foreach ( $wordReversed as $xvalue ) {
00760             foreach ( $allVowels as $yvalue ) {
00761                 if ( strcmp( $xvalue, $yvalue ) == 0 ) {
00762                     $lastLetter[1] = $xvalue;
00763                     break;
00764                 } else {
00765                     continue;
00766                 }
00767             }
00768             if ( $lastLetter[1] !== null ) {
00769                 break;
00770             } else {
00771                 continue;
00772             }
00773         }
00774 
00775         return $lastLetter;
00776     }
00777 
00785     function commafy( $_ ) {
00786         if ( !preg_match( '/^\d{1,4}$/', $_ ) ) {
00787             return strrev( (string)preg_replace( '/(\d{3})(?=\d)(?!\d*\.)/', '$1,', strrev( $_ ) ) );
00788         } else {
00789             return $_;
00790         }
00791     }
00792 }