MediaWiki  1.33.0
LanguageTyv.php
Go to the documentation of this file.
1 <?php
31 class LanguageTyv extends Language {
40  function convertGrammar( $word, $case ) {
41  global $wgGrammarForms;
42  if ( isset( $wgGrammarForms['tyv'][$case][$word] ) ) {
43  return $wgGrammarForms['tyv'][$case][$word];
44  }
45 
46  // Set up some constants...
47  $allVowels = [ "е", "и", "э", "ө", "ү", "а", "ё", "о", "у", "ы", "ю", "я" ];
48  $frontVowels = [ "е", "и", "э", "ө", "ү" ];
49  $backVowels = [ "а", "ё", "о", "у", "ы", "ю", "я" ];
50  $unroundFrontVowels = [ "е", "и", "э" ];
51  $roundFrontVowels = [ "ө", "ү" ];
52  $unroundBackVowels = [ "а", "ы", "я" ];
53  $roundBackVowels = [ "ё", "о", "у", "ю" ];
54  $unvoicedPhonemes = [ "т", "п", "с", "ш", "к", "ч", "х" ];
55  $directiveUnvoicedStems = [ "т", "п", "с", "ш", "к", "ч", "х", "л", "м", "н", "ң" ];
56  $directiveVoicedStems = [ "д", "б", "з", "ж", "г", "р", "й" ];
57 
58  // Put the word in a form we can play with since we're using UTF-8
59  preg_match_all( '/./us', $word, $ar );
60 
61  // Here's the last letter in the word
62  $wordEnding = $ar[0][count( $ar[0] ) - 1];
63 
64  // Here's an array with the order of the letters in the word reversed so
65  // we can find a match quicker. *shrug*
66  $wordReversed = array_reverse( $ar[0] );
67 
68  // Find the last vowel in the word
69  $wordLastVowel = null;
70  foreach ( $wordReversed as $xvalue ) {
71  foreach ( $allVowels as $yvalue ) {
72  if ( strcmp( $xvalue, $yvalue ) == 0 ) {
73  $wordLastVowel = $xvalue;
74  break;
75  }
76  }
77 
78  if ( $wordLastVowel !== null ) {
79  break;
80  }
81  }
82 
83  // Now convert the word
84  switch ( $case ) {
85  case "genitive":
86  if ( in_array( $wordEnding, $unvoicedPhonemes ) ) {
87  if ( in_array( $wordLastVowel, $roundFrontVowels ) ) {
88  $word = implode( "", $ar[0] ) . "түң";
89  } elseif ( in_array( $wordLastVowel, $unroundFrontVowels ) ) {
90  $word = implode( "", $ar[0] ) . "тиң";
91  } elseif ( in_array( $wordLastVowel, $roundBackVowels ) ) {
92  $word = implode( "", $ar[0] ) . "туң";
93  } elseif ( in_array( $wordLastVowel, $unroundBackVowels ) ) {
94  $word = implode( "", $ar[0] ) . "тың";
95  } else {
96  }
97  } elseif ( $wordEnding === "л" ) {
98  if ( in_array( $wordLastVowel, $roundFrontVowels ) ) {
99  $word = implode( "", $ar[0] ) . "дүң";
100  } elseif ( in_array( $wordLastVowel, $unroundFrontVowels ) ) {
101  $word = implode( "", $ar[0] ) . "диң";
102  } elseif ( in_array( $wordLastVowel, $roundBackVowels ) ) {
103  $word = implode( "", $ar[0] ) . "дуң";
104  } elseif ( in_array( $wordLastVowel, $unroundBackVowels ) ) {
105  $word = implode( "", $ar[0] ) . "дың";
106  } else {
107  }
108  } else {
109  if ( in_array( $wordLastVowel, $roundFrontVowels ) ) {
110  $word = implode( "", $ar[0] ) . "нүң";
111  } elseif ( in_array( $wordLastVowel, $unroundFrontVowels ) ) {
112  $word = implode( "", $ar[0] ) . "ниң";
113  } elseif ( in_array( $wordLastVowel, $roundBackVowels ) ) {
114  $word = implode( "", $ar[0] ) . "нуң";
115  } elseif ( in_array( $wordLastVowel, $unroundBackVowels ) ) {
116  $word = implode( "", $ar[0] ) . "ның";
117  } else {
118  }
119  }
120  break;
121  case "dative":
122  if ( in_array( $wordEnding, $unvoicedPhonemes ) ) {
123  if ( in_array( $wordLastVowel, $frontVowels ) ) {
124  $word = implode( "", $ar[0] ) . "ке";
125  } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
126  $word = implode( "", $ar[0] ) . "ка";
127  } else {
128  }
129  } else {
130  if ( in_array( $wordLastVowel, $frontVowels ) ) {
131  $word = implode( "", $ar[0] ) . "ге";
132  } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
133  $word = implode( "", $ar[0] ) . "га";
134  } else {
135  }
136  }
137  break;
138  case "accusative":
139  if ( in_array( $wordEnding, $unvoicedPhonemes ) ) {
140  if ( in_array( $wordLastVowel, $roundFrontVowels ) ) {
141  $word = implode( "", $ar[0] ) . "тү";
142  } elseif ( in_array( $wordLastVowel, $unroundFrontVowels ) ) {
143  $word = implode( "", $ar[0] ) . "ти";
144  } elseif ( in_array( $wordLastVowel, $roundBackVowels ) ) {
145  $word = implode( "", $ar[0] ) . "ту";
146  } elseif ( in_array( $wordLastVowel, $unroundBackVowels ) ) {
147  $word = implode( "", $ar[0] ) . "ты";
148  } else {
149  }
150  } elseif ( $wordEnding === "л" ) {
151  if ( in_array( $wordLastVowel, $roundFrontVowels ) ) {
152  $word = implode( "", $ar[0] ) . "дү";
153  } elseif ( in_array( $wordLastVowel, $unroundFrontVowels ) ) {
154  $word = implode( "", $ar[0] ) . "ди";
155  } elseif ( in_array( $wordLastVowel, $roundBackVowels ) ) {
156  $word = implode( "", $ar[0] ) . "ду";
157  } elseif ( in_array( $wordLastVowel, $unroundBackVowels ) ) {
158  $word = implode( "", $ar[0] ) . "ды";
159  } else {
160  }
161  } else {
162  if ( in_array( $wordLastVowel, $roundFrontVowels ) ) {
163  $word = implode( "", $ar[0] ) . "нү";
164  } elseif ( in_array( $wordLastVowel, $unroundFrontVowels ) ) {
165  $word = implode( "", $ar[0] ) . "ни";
166  } elseif ( in_array( $wordLastVowel, $roundBackVowels ) ) {
167  $word = implode( "", $ar[0] ) . "ну";
168  } elseif ( in_array( $wordLastVowel, $unroundBackVowels ) ) {
169  $word = implode( "", $ar[0] ) . "ны";
170  } else {
171  }
172  }
173  break;
174  case "locative":
175  if ( in_array( $wordEnding, $unvoicedPhonemes ) ) {
176  if ( in_array( $wordLastVowel, $frontVowels ) ) {
177  $word = implode( "", $ar[0] ) . "те";
178  } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
179  $word = implode( "", $ar[0] ) . "та";
180  } else {
181  }
182  } else {
183  if ( in_array( $wordLastVowel, $frontVowels ) ) {
184  $word = implode( "", $ar[0] ) . "де";
185  } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
186  $word = implode( "", $ar[0] ) . "да";
187  } else {
188  }
189  }
190  break;
191  case "ablative":
192  if ( in_array( $wordEnding, $unvoicedPhonemes ) ) {
193  if ( in_array( $wordLastVowel, $frontVowels ) ) {
194  $word = implode( "", $ar[0] ) . "тен";
195  } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
196  $word = implode( "", $ar[0] ) . "тан";
197  } else {
198  }
199  } else {
200  if ( in_array( $wordLastVowel, $frontVowels ) ) {
201  $word = implode( "", $ar[0] ) . "ден";
202  } elseif ( in_array( $wordLastVowel, $backVowels ) ) {
203  $word = implode( "", $ar[0] ) . "дан";
204  } else {
205  }
206  }
207  break;
208  case "directive1":
209  if ( in_array( $wordEnding, $directiveVoicedStems ) ) {
210  $word = implode( "", $ar[0] ) . "же";
211  } elseif ( in_array( $wordEnding, $directiveUnvoicedStems ) ) {
212  $word = implode( "", $ar[0] ) . "че";
213  } else {
214  }
215  break;
216  case "directive2":
217  if ( in_array( $wordEnding, $unvoicedPhonemes ) ) {
218  if ( in_array( $wordLastVowel, $roundFrontVowels ) ) {
219  $word = implode( "", $ar[0] ) . "түве";
220  } elseif ( in_array( $wordLastVowel, $unroundFrontVowels ) ) {
221  $word = implode( "", $ar[0] ) . "тиве";
222  } elseif ( in_array( $wordLastVowel, $roundBackVowels ) ) {
223  $word = implode( "", $ar[0] ) . "туве";
224  } elseif ( in_array( $wordLastVowel, $unroundBackVowels ) ) {
225  $word = implode( "", $ar[0] ) . "тыве";
226  } else {
227  }
228  } else {
229  if ( in_array( $wordLastVowel, $roundFrontVowels ) ) {
230  $word = implode( "", $ar[0] ) . "дүве";
231  } elseif ( in_array( $wordLastVowel, $unroundFrontVowels ) ) {
232  $word = implode( "", $ar[0] ) . "диве";
233  } elseif ( in_array( $wordLastVowel, $roundBackVowels ) ) {
234  $word = implode( "", $ar[0] ) . "дуве";
235  } elseif ( in_array( $wordLastVowel, $unroundBackVowels ) ) {
236  $word = implode( "", $ar[0] ) . "дыве";
237  } else {
238  }
239  }
240  break;
241  default:
242  break;
243  }
244 
245  return $word;
246  }
247 }
captcha-old.count
count
Definition: captcha-old.py:249
LanguageTyv
Tyvan localization (Тыва дыл)
Definition: LanguageTyv.php:31
php
injection txt This is an overview of how MediaWiki makes use of dependency injection The design described here grew from the discussion of RFC T384 The term dependency this means that anything an object needs to operate should be injected from the the object itself should only know narrow no concrete implementation of the logic it relies on The requirement to inject everything typically results in an architecture that based on two main types of and essentially stateless service objects that use other service objects to operate on the value objects As of the beginning MediaWiki is only starting to use the DI approach Much of the code still relies on global state or direct resulting in a highly cyclical dependency which acts as the top level factory for services in MediaWiki which can be used to gain access to default instances of various services MediaWikiServices however also allows new services to be defined and default services to be redefined Services are defined or redefined by providing a callback the instantiator that will return a new instance of the service When it will create an instance of MediaWikiServices and populate it with the services defined in the files listed by thereby bootstrapping the DI framework Per $wgServiceWiringFiles lists includes ServiceWiring php
Definition: injection.txt:35
LanguageTyv\convertGrammar
convertGrammar( $word, $case)
Grammatical transformations, needed for inflected languages Invoked by putting {{grammar:case|word}} ...
Definition: LanguageTyv.php:40
$wgGrammarForms
$wgGrammarForms
Some languages need different word forms, usually for different cases.
Definition: DefaultSettings.php:2929
as
This document is intended to provide useful advice for parties seeking to redistribute MediaWiki to end users It s targeted particularly at maintainers for Linux since it s been observed that distribution packages of MediaWiki often break We ve consistently had to recommend that users seeking support use official tarballs instead of their distribution s and this often solves whatever problem the user is having It would be nice if this could such as
Definition: distributors.txt:9
Language
Internationalisation code.
Definition: Language.php:36