2 /** Tyvan localization (Тыва дыл)
7 # From friends at tyvawiki.org
9 #--------------------------------------------------------------------------
10 # Internationalisation code
11 #--------------------------------------------------------------------------
13 class LanguageTyv
extends Language
{
15 * Grammatical transformations, needed for inflected languages
16 * Invoked by putting {{grammar:case|word}} in a message
22 function convertGrammar( $word, $case ) {
23 global $wgGrammarForms;
24 if ( isset($wgGrammarForms['tyv'][$case][$word]) ) {
25 return $wgGrammarForms['tyv'][$case][$word];
29 // Set up some constants...
30 $allVowels = array("е", "и", "э", "ө", "ү", "а", "ё", "о", "у", "ы", "ю", "я", "a", "e", "i", "o", "ö", "u", "ü", "y");
31 $frontVowels = array("е", "и", "э", "ө", "ү", "e", "i", "ö", "ü");
32 $backVowels = array("а", "ё", "о", "у", "ы", "ю", "я", "a", "o", "u", "y");
33 $unroundFrontVowels = array("е", "и", "э", "e", "i");
34 $roundFrontVowels = array("ө", "ү", "ö", "ü");
35 $unroundBackVowels = array("а", "ы", "я", "a", "y");
36 $roundBackVowels = array("ё", "о", "у", "ю", "o", "u");
37 $voicedPhonemes = array("д", "б", "з", "ж", "г", "d", "b", "z", "g");
38 $unvoicedPhonemes = array("т", "п", "с", "ш", "к", "ч", "х", "t", "p", "s", "k", "x");
39 $directiveUnvoicedStems = array("т", "п", "с", "ш", "к", "ч", "х", "л", "м", "н", "ң", "t", "p", "s", "k", "x", "l", "m", "n", "ŋ");
40 $directiveVoicedStems = array("д", "б", "з", "ж", "г", "р", "й", "d", "b", "z", "g", "r", "j");
42 // $allSonants = array("л", "м", "н", "ң", "р", "й");
43 // $allNasals = array("м", "н", "ң");
45 // Put the word in a form we can play with since we're using UTF-8
46 preg_match_all( '/./us', $word, $ar );
48 $wordEnding = $ar[0][count($ar[0]) - 1]; //Here's the last letter in the word
49 $wordReversed = array_reverse($ar[0]); //Here's an array with the order of the letters in the word reversed so we can find a match quicker *shrug*
51 // Find the last vowel in the word
52 $wordLastVowel = NULL;
53 foreach ( $wordReversed as $xvalue ) {
54 foreach ( $allVowels as $yvalue ) {
55 if ( strcmp($xvalue, $yvalue) == 0 ) {
56 $wordLastVowel = $xvalue;
62 if ( $wordLastVowel !== NULL ) {
69 // Now convert the word
72 if ( in_array($wordEnding, $unvoicedPhonemes) ) {
73 if ( in_array($wordLastVowel, $roundFrontVowels) ) {
74 $word = implode("",$ar[0]) . "түң";
75 } elseif ( in_array($wordLastVowel, $unroundFrontVowels) ) {
76 $word = implode("",$ar[0]) . "тиң";
77 } elseif ( in_array($wordLastVowel, $roundBackVowels) ) {
78 $word = implode("",$ar[0]) . "туң";
79 } elseif ( in_array($wordLastVowel, $unroundBackVowels) ) {
80 $word = implode("",$ar[0]) . "тың";
83 } elseif ( $wordEnding === "л" ||
$wordEnding === "l") {
84 if ( in_array($wordLastVowel, $roundFrontVowels) ) {
85 $word = implode("",$ar[0]) . "дүң";
86 } elseif ( in_array($wordLastVowel, $unroundFrontVowels) ) {
87 $word = implode("",$ar[0]) . "диң";
88 } elseif ( in_array($wordLastVowel, $roundBackVowels) ) {
89 $word = implode("",$ar[0]) . "дуң";
90 } elseif ( in_array($wordLastVowel, $unroundBackVowels) ) {
91 $word = implode("",$ar[0]) . "дың";
95 if ( in_array($wordLastVowel, $roundFrontVowels) ) {
96 $word = implode("",$ar[0]) . "нүң";
97 } elseif ( in_array($wordLastVowel, $unroundFrontVowels) ) {
98 $word = implode("",$ar[0]) . "ниң";
99 } elseif ( in_array($wordLastVowel, $roundBackVowels) ) {
100 $word = implode("",$ar[0]) . "нуң";
101 } elseif ( in_array($wordLastVowel, $unroundBackVowels) ) {
102 $word = implode("",$ar[0]) . "ның";
108 if ( in_array($wordEnding, $unvoicedPhonemes) ) {
109 if ( in_array($wordLastVowel, $frontVowels) ) {
110 $word = implode("",$ar[0]) . "ке";
111 } elseif ( in_array($wordLastVowel, $backVowels) ) {
112 $word = implode("",$ar[0]) . "ка";
116 if ( in_array($wordLastVowel, $frontVowels) ) {
117 $word = implode("",$ar[0]) . "ге";
118 } elseif ( in_array($wordLastVowel, $backVowels) ) {
119 $word = implode("",$ar[0]) . "га";
125 if ( in_array($wordEnding, $unvoicedPhonemes) ) {
126 if ( in_array($wordLastVowel, $roundFrontVowels) ) {
127 $word = implode("",$ar[0]) . "тү";
128 } elseif ( in_array($wordLastVowel, $unroundFrontVowels) ) {
129 $word = implode("",$ar[0]) . "ти";
130 } elseif ( in_array($wordLastVowel, $roundBackVowels) ) {
131 $word = implode("",$ar[0]) . "ту";
132 } elseif ( in_array($wordLastVowel, $unroundBackVowels) ) {
133 $word = implode("",$ar[0]) . "ты";
136 } elseif ( $wordEnding === "л" ||
$wordEnding === "l") {
137 if ( in_array($wordLastVowel, $roundFrontVowels) ) {
138 $word = implode("",$ar[0]) . "дү";
139 } elseif ( in_array($wordLastVowel, $unroundFrontVowels) ) {
140 $word = implode("",$ar[0]) . "ди";
141 } elseif ( in_array($wordLastVowel, $roundBackVowels) ) {
142 $word = implode("",$ar[0]) . "ду";
143 } elseif ( in_array($wordLastVowel, $unroundBackVowels) ) {
144 $word = implode("",$ar[0]) . "ды";
148 if ( in_array($wordLastVowel, $roundFrontVowels) ) {
149 $word = implode("",$ar[0]) . "нү";
150 } elseif ( in_array($wordLastVowel, $unroundFrontVowels) ) {
151 $word = implode("",$ar[0]) . "ни";
152 } elseif ( in_array($wordLastVowel, $roundBackVowels) ) {
153 $word = implode("",$ar[0]) . "ну";
154 } elseif ( in_array($wordLastVowel, $unroundBackVowels) ) {
155 $word = implode("",$ar[0]) . "ны";
161 if ( in_array($wordEnding, $unvoicedPhonemes) ) {
162 if ( in_array($wordLastVowel, $frontVowels) ) {
163 $word = implode("",$ar[0]) . "те";
164 } elseif ( in_array($wordLastVowel, $backVowels) ) {
165 $word = implode("",$ar[0]) . "та";
169 if ( in_array($wordLastVowel, $frontVowels) ) {
170 $word = implode("",$ar[0]) . "де";
171 } elseif ( in_array($wordLastVowel, $backVowels) ) {
172 $word = implode("",$ar[0]) . "да";
178 if ( in_array($wordEnding, $unvoicedPhonemes) ) {
179 if ( in_array($wordLastVowel, $frontVowels) ) {
180 $word = implode("",$ar[0]) . "тен";
181 } elseif ( in_array($wordLastVowel, $backVowels) ) {
182 $word = implode("",$ar[0]) . "тан";
186 if ( in_array($wordLastVowel, $frontVowels) ) {
187 $word = implode("",$ar[0]) . "ден";
188 } elseif ( in_array($wordLastVowel, $backVowels) ) {
189 $word = implode("",$ar[0]) . "дан";
195 if ( in_array($wordEnding, $directiveVoicedStems) ) {
196 $word = implode("",$ar[0]) . "же";
197 } elseif ( in_array($wordEnding, $directiveUnvoicedStems) ) {
198 $word = implode("",$ar[0]) . "че";
203 if ( in_array($wordEnding, $unvoicedPhonemes) ) {
204 if ( in_array($wordLastVowel, $roundFrontVowels) ) {
205 $word = implode("",$ar[0]) . "түве";
206 } elseif ( in_array($wordLastVowel, $unroundFrontVowels) ) {
207 $word = implode("",$ar[0]) . "тиве";
208 } elseif ( in_array($wordLastVowel, $roundBackVowels) ) {
209 $word = implode("",$ar[0]) . "туве";
210 } elseif ( in_array($wordLastVowel, $unroundBackVowels) ) {
211 $word = implode("",$ar[0]) . "тыве";
215 if ( in_array($wordLastVowel, $roundFrontVowels) ) {
216 $word = implode("",$ar[0]) . "дүве";
217 } elseif ( in_array($wordLastVowel, $unroundFrontVowels) ) {
218 $word = implode("",$ar[0]) . "диве";
219 } elseif ( in_array($wordLastVowel, $roundBackVowels) ) {
220 $word = implode("",$ar[0]) . "дуве";
221 } elseif ( in_array($wordLastVowel, $unroundBackVowels) ) {
222 $word = implode("",$ar[0]) . "дыве";