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