37 const C_UC =
'АБВГДЕЁЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯ'; # Crimean Tatar Cyrillic uppercase
38 const C_LC =
'абвгдеёжзийклмнопрстуфхцчшщъыьэюя'; # Crimean Tatar Cyrillic lowercase
39 const C_CONS_UC =
'БВГДЖЗЙКЛМНПРСТФХЦЧШЩCÑ'; # Crimean Tatar Cyrillic + CÑ uppercase consonants
40 const C_CONS_LC =
'бвгджзйклмнпрстфхцчшщcñ'; # Crimean Tatar Cyrillic + CÑ lowercase consonants
41 const C_M_CONS =
'бгкмпшcБГКМПШC'; # Crimean Tatar Cyrillic M-
type consonants
43 # Crimean Tatar Cyrillic + CÑ consonants
44 const C_CONS =
'бвгджзйклмнпрстфхцчшщcñБВГДЖЗЙКЛМНПРСТФХЦЧШЩCÑ';
47 const L_UC =
'AÂBCÇDEFGĞHIİJKLMNÑOÖPQRSŞTUÜVYZ'; # Crimean Tatar Latin uppercase
48 const L_LC =
'aâbcçdefgğhıijklmnñoöpqrsştuüvyz'; # Crimean Tatar Latin lowercase
51 const L_N_CONS =
'çnrstzÇNRSTZ'; # Crimean Tatar Latin N-
type consonants
52 const L_M_CONS =
'bcgkmpşBCGKMPŞ'; # Crimean Tatar Latin M-
type consonants
53 const L_CONS_UC =
'BCÇDFGHJKLMNÑPRSŞTVZ'; # Crimean Tatar Latin uppercase consonants
54 const L_CONS_LC =
'bcçdfghjklmnñprsştvz'; # Crimean Tatar Latin lowercase consonants
55 const L_CONS =
'bcçdfghjklmnñprsştvzBCÇDFGHJKLMNÑPRSŞTVZ'; # Crimean Tatar Latin consonants
56 const L_VOW_UC =
'AÂEIİOÖUÜ'; # Crimean Tatar Latin uppercase vowels
57 const L_VOW =
'aâeıioöuüAÂEIİOÖUÜ'; # Crimean Tatar Latin vowels
58 const L_F_UC =
'EİÖÜ'; # Crimean Tatar Latin uppercase front vowels
59 const L_F =
'eiöüEİÖÜ'; # Crimean Tatar Latin front vowels
70 $variantfallbacks = [],
72 parent::__construct( $langobj, $maincode,
73 $variants, $variantfallbacks, $flags );
83 ## these are independent of location in the word, but have
84 ## to go first so other transforms don't bleed them
85 'гъ' =>
'ğ',
'Гъ' =>
'Ğ',
'ГЪ' =>
'Ğ',
86 'къ' =>
'q',
'Къ' =>
'Q',
'КЪ' =>
'Q',
87 'нъ' =>
'ñ',
'Нъ' =>
'Ñ',
'НЪ' =>
'Ñ',
88 'дж' =>
'c',
'Дж' =>
'C',
'ДЖ' =>
'C',
90 'А' =>
'A',
'а' =>
'a',
'Б' =>
'B',
'б' =>
'b',
91 'В' =>
'V',
'в' =>
'v',
'Г' =>
'G',
'г' =>
'g',
92 'Д' =>
'D',
'д' =>
'd',
'Ж' =>
'J',
'ж' =>
'j',
93 'З' =>
'Z',
'з' =>
'z',
'И' =>
'İ',
'и' =>
'i',
94 'Й' =>
'Y',
'й' =>
'y',
'К' =>
'K',
'к' =>
'k',
95 'Л' =>
'L',
'л' =>
'l',
'М' =>
'M',
'м' =>
'm',
96 'Н' =>
'N',
'н' =>
'n',
'П' =>
'P',
'п' =>
'p',
97 'Р' =>
'R',
'р' =>
'r',
'С' =>
'S',
'с' =>
's',
98 'Т' =>
'T',
'т' =>
't',
'Ф' =>
'F',
'ф' =>
'f',
99 'Х' =>
'H',
'х' =>
'h',
'Ч' =>
'Ç',
'ч' =>
'ç',
100 'Ш' =>
'Ş',
'ш' =>
'ş',
'Ы' =>
'I',
'ы' =>
'ı',
101 'Э' =>
'E',
'э' =>
'e',
'Е' =>
'E',
'е' =>
'e',
102 'Я' =>
'Â',
'я' =>
'â',
'У' =>
'U',
'у' =>
'u',
103 'О' =>
'O',
'о' =>
'o',
105 'Ё' =>
'Yo',
'ё' =>
'yo',
'Ю' =>
'Yu',
'ю' =>
'yu',
106 'Ц' =>
'Ts',
'ц' =>
'ts',
'Щ' =>
'Şç',
'щ' =>
'şç',
107 'Ь' =>
'',
'ь' =>
'',
'Ъ' =>
'',
'ъ' =>
'',
112 'Â' =>
'Я',
'â' =>
'я',
'B' =>
'Б',
'b' =>
'б',
113 'Ç' =>
'Ч',
'ç' =>
'ч',
'D' =>
'Д',
'd' =>
'д',
114 'F' =>
'Ф',
'f' =>
'ф',
'G' =>
'Г',
'g' =>
'г',
115 'H' =>
'Х',
'h' =>
'х',
'I' =>
'Ы',
'ı' =>
'ы',
116 'İ' =>
'И',
'i' =>
'и',
'J' =>
'Ж',
'j' =>
'ж',
117 'K' =>
'К',
'k' =>
'к',
'L' =>
'Л',
'l' =>
'л',
118 'M' =>
'М',
'm' =>
'м',
'N' =>
'Н',
'n' =>
'н',
119 'O' =>
'О',
'o' =>
'о',
'P' =>
'П',
'p' =>
'п',
120 'R' =>
'Р',
'r' =>
'р',
'S' =>
'С',
's' =>
'с',
121 'Ş' =>
'Ш',
'ş' =>
'ш',
'T' =>
'Т',
't' =>
'т',
122 'V' =>
'В',
'v' =>
'в',
'Z' =>
'З',
'z' =>
'з',
124 'ya' =>
'я',
'Ya' =>
'Я',
'YA' =>
'Я',
125 'ye' =>
'е',
'YE' =>
'Е',
'Ye' =>
'Е',
128 'A' =>
'А',
'a' =>
'а',
'E' =>
'Е',
'e' =>
'е',
129 'Ö' =>
'Ё',
'ö' =>
'ё',
'U' =>
'У',
'u' =>
'у',
130 'Ü' =>
'Ю',
'ü' =>
'ю',
'Y' =>
'Й',
'y' =>
'й',
131 'C' =>
'Дж',
'c' =>
'дж',
'Ğ' =>
'Гъ',
'ğ' =>
'гъ',
132 'Ñ' =>
'Нъ',
'ñ' =>
'нъ',
'Q' =>
'Къ',
'q' =>
'къ',
152 if ( $this->mExceptionsLoaded ) {
156 $this->mExceptionsLoaded =
true;
158 list( $this->mExceptions, $this->mCyrl2LatnPatterns, $this->mLatn2CyrlPatterns,
159 $this->mCyrlCleanUpRegexes ) = $crhExceptions->loadExceptions( self::L_LC . self::C_LC,
160 self::L_UC . self::C_UC );
175 if ( is_object( $nt ) ) {
176 $ns = $nt->getNamespace();
183 parent::findVariantLink(
$link, $nt, $ignoreOtherCond );
184 if ( $this->getPreferredVariant() == $this->mMainLanguageCode ) {
201 switch ( $toVariant ) {
203 $letters = self::L_UC . self::L_LC .
"\'";
206 $letters = self::C_UC . self::C_LC .
"";
213 if ( !$this->mTablesLoaded ) {
217 if ( !isset( $this->mTables[$toVariant] ) ) {
218 throw new MWException(
"Broken variant table: " . implode(
',', array_keys( $this->mTables ) ) );
223 $roman =
'/^(?=[MDCLXVI])M{0,4}(C[DM]|D?C{0,3})(X[LC]|L?X{0,3})(I[VX]|V?I{0,3})$/u';
225 # match any sub-string of the relevant letters and convert it
226 $matches = preg_split(
'/(\b|^)[^' . $letters .
']+(\b|$)/u',
227 $text, -1, PREG_SPLIT_OFFSET_CAPTURE );
231 # copy over the non-matching bit
232 $ret .= substr( $text, $mstart, $m[1] - $mstart );
233 # skip certain classes of strings
235 if ( array_key_exists( $m[0], $this->mExceptions ) ) {
236 # if it's an exception, just copy down the right answer
237 $ret .= $this->mExceptions[$m[0]];
238 } elseif ( ! $m[0] || # empty
strings
239 preg_match( $roman, $m[0] ) || # roman numerals
240 preg_match(
'/[^' . $letters .
']/', $m[0] ) # mixed orthography
244 # convert according to the rules
248 $mstart = $m[1] + strlen( $m[0] );
251 # pick up stray quote marks
252 switch ( $toVariant ) {
254 $ret = strtr(
$ret, [
'“' =>
'«',
'”' =>
'»', ] );
258 $ret = strtr(
$ret, [
'«' =>
'"',
'»' =>
'"', ] );
266 if ( $text ==
'' )
return $text;
270 switch ( $toVariant ) {
272 foreach ( $this->mCyrl2LatnPatterns
as $pat => $rep ) {
273 $text = preg_replace( $pat, $rep, $text );
277 foreach ( $this->mLatn2CyrlPatterns
as $pat => $rep ) {
278 $text = preg_replace( $pat, $rep, $text );
282 foreach ( $this->mCyrlCleanUpRegexes
as $pat => $rep ) {
283 $text = preg_replace( $pat, $rep, $text );
301 parent::__construct();
303 $variants = [
'crh',
'crh-cyrl',
'crh-latn' ];
304 $variantfallbacks = [
306 'crh-cyrl' =>
'crh-latn',
307 'crh-latn' =>
'crh-cyrl',
310 $this->mConverter =
new CrhConverter( $this,
'crh', $variants, $variantfallbacks );