MediaWiki REL1_33
LanguageUz.php
Go to the documentation of this file.
1<?php
28 public $toLatin = [
29 'а' => 'a', 'А' => 'A',
30 'б' => 'b', 'Б' => 'B',
31 'д' => 'd', 'Д' => 'D',
32 'е' => 'e', 'Е' => 'E',
33 'э' => 'e', 'Э' => 'E',
34 'в' => 'v', 'В' => 'V',
35 'х' => 'x', 'Х' => 'X',
36 'ғ' => 'gʻ', 'Ғ' => 'Gʻ',
37 'г' => 'g', 'Г' => 'G',
38 'ҳ' => 'h', 'Ҳ' => 'H',
39 'ж' => 'j', 'Ж' => 'J',
40 'з' => 'z', 'З' => 'Z',
41 'и' => 'i', 'И' => 'I',
42 'к' => 'k', 'К' => 'K',
43 'л' => 'l', 'Л' => 'L',
44 'м' => 'm', 'М' => 'M',
45 'н' => 'n', 'Н' => 'N',
46 'о' => 'o', 'О' => 'O',
47 'п' => 'p', 'П' => 'P',
48 'р' => 'r', 'Р' => 'R',
49 'с' => 's', 'С' => 'S',
50 'т' => 't', 'Т' => 'T',
51 'у' => 'u', 'У' => 'U',
52 'ф' => 'f', 'Ф' => 'F',
53 'ў' => 'oʻ', 'Ў' => 'Oʻ',
54 // note: at the beginning of a word and right after a consonant, only "s" is used
55 'ц' => 'ts', 'Ц' => 'Ts',
56 'қ' => 'q', 'Қ' => 'Q',
57 'ё' => 'yo', 'Ё' => 'Yo',
58 'ю' => 'yu', 'Ю' => 'Yu',
59 'ч' => 'ch', 'Ч' => 'Ch',
60 'ш' => 'sh', 'Ш' => 'Sh',
61 'й' => 'y', 'Й' => 'Y',
62 'я' => 'ya', 'Я' => 'Ya',
63 'ъ' => 'ʼ',
64 ];
65
66 public $toCyrillic = [
67 'a' => 'а', 'A' => 'А',
68 'b' => 'б', 'B' => 'Б',
69 'd' => 'д', 'D' => 'Д',
70 // at the beginning of a word and after a vowel, "э" is used instead of "e"
71 // (see regex below)
72 'e' => 'э', 'E' => 'Э',
73 'f' => 'ф', 'F' => 'Ф',
74 'g' => 'г', 'G' => 'Г',
75 'g‘' => 'ғ', 'G‘' => 'Ғ', 'gʻ' => 'ғ', 'Gʻ' => 'Ғ',
76 'h' => 'ҳ', 'H' => 'Ҳ',
77 'i' => 'и', 'I' => 'И',
78 'k' => 'к', 'K' => 'К',
79 'l' => 'л', 'L' => 'Л',
80 'm' => 'м', 'M' => 'М',
81 'n' => 'н', 'N' => 'Н',
82 'o' => 'о', 'O' => 'О',
83 'p' => 'п', 'P' => 'П',
84 'r' => 'р', 'R' => 'Р',
85 's' => 'с', 'S' => 'С',
86 't' => 'т', 'T' => 'Т',
87 'u' => 'у', 'U' => 'У',
88 'v' => 'в', 'V' => 'В',
89 'x' => 'х', 'X' => 'Х',
90 'z' => 'з', 'Z' => 'З',
91 'j' => 'ж', 'J' => 'Ж',
92 'o‘' => 'ў', 'O‘' => 'Ў', 'oʻ' => 'ў', 'Oʻ' => 'Ў',
93 'yo‘' => 'йў', 'Yo‘' => 'Йў', 'yoʻ' => 'йў', 'Yoʻ' => 'Йў',
94 'ts' => 'ц', 'Ts' => 'Ц',
95 'q' => 'қ', 'Q' => 'Қ',
96 'yo' => 'ё', 'Yo' => 'Ё',
97 'yu' => 'ю', 'Yu' => 'Ю',
98 'ch' => 'ч', 'Ch' => 'Ч',
99 'sh' => 'ш', 'Sh' => 'Ш',
100 'y' => 'й', 'Y' => 'Й',
101 'ya' => 'я', 'Ya' => 'Я',
102 'ʼ' => 'ъ',
103 ];
104
105 function loadDefaultTables() {
106 $this->mTables = [
107 'uz-cyrl' => new ReplacementArray( $this->toCyrillic ),
108 'uz-latn' => new ReplacementArray( $this->toLatin ),
109 'uz' => new ReplacementArray()
110 ];
111 }
112
113 function translate( $text, $toVariant ) {
114 if ( $toVariant == 'uz-cyrl' ) {
115 $text = str_replace( 'ye', 'е', $text );
116 $text = str_replace( 'Ye', 'Е', $text );
117 $text = str_replace( 'YE', 'Е', $text );
118 // "е" after consonants, otherwise "э" (see above)
119 $text = preg_replace( '/([BVGDJZYKLMNPRSTFXCWQʻ‘H])E/u', '$1Е', $text );
120 $text = preg_replace( '/([bvgdjzyklmnprstfxcwqʻ‘h])e/ui', '$1е', $text );
121 }
122 return parent::translate( $text, $toVariant );
123 }
124
125}
126
132class LanguageUz extends Language {
133 function __construct() {
134 parent::__construct();
135
136 $variants = [ 'uz', 'uz-latn', 'uz-cyrl' ];
137 $variantfallbacks = [
138 'uz' => 'uz-latn',
139 'uz-cyrl' => 'uz',
140 'uz-latn' => 'uz',
141 ];
142
143 $this->mConverter = new UzConverter( $this, 'uz', $variants, $variantfallbacks );
144 }
145}
and that you know you can do these things To protect your we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights These restrictions translate to certain responsibilities for you if you distribute copies of the or if you modify it For if you distribute copies of such a whether gratis or for a you must give the recipients all the rights that you have You must make sure that receive or can get the source code And you must show them these terms so they know their rights We protect your rights with two and(2) offer you this license which gives you legal permission to copy
Base class for language conversion.
Internationalisation code.
Definition Language.php:36
Wrapper around strtr() that holds replacements.
loadDefaultTables()
Load default conversion tables.
translate( $text, $toVariant)
Translate a string to a variant.