phpcs: More require/include is not a function
[lhc/web/wiklou.git] / languages / classes / LanguageUz.php
1 <?php
2 /**
3 * Uzbek specific code.
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 * http://www.gnu.org/copyleft/gpl.html
19 *
20 * @file
21 * @ingroup Language
22 */
23
24 require_once __DIR__ . '/../LanguageConverter.php';
25
26 /**
27 * @ingroup Language
28 */
29 class UzConverter extends LanguageConverter {
30 public $toLatin = array(
31 'а' => 'a', 'А' => 'A',
32 'б' => 'b', 'Б' => 'B',
33 'д' => 'd', 'Д' => 'D',
34 'е' => 'e', 'Е' => 'E',
35 'э' => 'e', 'Э' => 'E',
36 'в' => 'v', 'В' => 'V',
37 'х' => 'x', 'Х' => 'X',
38 'ғ' => 'gʻ', 'Ғ' => 'Gʻ',
39 'г' => 'g', 'Г' => 'G',
40 'ҳ' => 'h', 'Ҳ' => 'H',
41 'ж' => 'j', 'Ж' => 'J',
42 'з' => 'z', 'З' => 'Z',
43 'и' => 'i', 'И' => 'I',
44 'к' => 'k', 'К' => 'K',
45 'л' => 'l', 'Л' => 'L',
46 'м' => 'm', 'М' => 'M',
47 'н' => 'n', 'Н' => 'N',
48 'о' => 'o', 'О' => 'O',
49 'п' => 'p', 'П' => 'P',
50 'р' => 'r', 'Р' => 'R',
51 'с' => 's', 'С' => 'S',
52 'т' => 't', 'Т' => 'T',
53 'у' => 'u', 'У' => 'U',
54 'ф' => 'f', 'Ф' => 'F',
55 'ц' => 'c', 'Ц' => 'C',
56 'ў' => 'oʻ', 'Ў' => 'Oʻ',
57 'ц' => 'ts', 'Ц' => 'Ts', // note: at the beginning of a word and right after a consonant, only "s" is used
58 'қ' => 'q', 'Қ' => 'Q',
59 'ё' => 'yo', 'Ё' => 'Yo',
60 'ю' => 'yu', 'Ю' => 'Yu',
61 'ч' => 'ch', 'Ч' => 'Ch',
62 'ш' => 'sh', 'Ш' => 'Sh',
63 'й' => 'y', 'Й' => 'Y',
64 'я' => 'ya', 'Я' => 'Ya',
65 'ъ' => 'ʼ',
66 );
67
68 public $toCyrillic = array(
69 'a' => 'а', 'A' => 'А',
70 'b' => 'б', 'B' => 'Б',
71 'd' => 'д', 'D' => 'Д',
72 'e' => 'е', 'E' => 'Е',
73 ' e' => ' э', ' E' => ' Э', // "э" is used at the beginning of a word instead of "e"
74 'ye' => 'е', 'Ye' => 'Е',
75 'f' => 'ф', 'F' => 'Ф',
76 'g' => 'г', 'G' => 'Г',
77 'g‘' => 'ғ', 'G‘' => 'Ғ', 'gʻ' => 'ғ', 'Gʻ' => 'Ғ',
78 'h' => 'ҳ', 'H' => 'Ҳ',
79 'i' => 'и', 'I' => 'И',
80 'k' => 'к', 'K' => 'К',
81 'l' => 'л', 'L' => 'Л',
82 'm' => 'м', 'M' => 'М',
83 'n' => 'н', 'N' => 'Н',
84 'o' => 'о', 'O' => 'О',
85 'p' => 'п', 'P' => 'П',
86 'r' => 'р', 'R' => 'Р',
87 's' => 'с', 'S' => 'С',
88 't' => 'т', 'T' => 'Т',
89 'u' => 'у', 'U' => 'У',
90 'v' => 'в', 'V' => 'В',
91 'x' => 'х', 'X' => 'Х',
92 'z' => 'з', 'Z' => 'З',
93 'j' => 'ж', 'J' => 'Ж',
94 'o‘' => 'ў', 'O‘' => 'Ў', 'oʻ' => 'ў', 'Oʻ' => 'Ў',
95 'yo‘' => 'йў', 'Yo‘' => 'Йў', 'yoʻ' => 'йў', 'Yoʻ' => 'Йў',
96 'ts' => 'ц', 'Ts' => 'Ц',
97 'q' => 'қ', 'Q' => 'Қ',
98 'yo' => 'ё', 'Yo' => 'Ё',
99 'yu' => 'ю', 'Yu' => 'Ю',
100 'ch' => 'ч', 'Ch' => 'Ч',
101 'sh' => 'ш', 'Sh' => 'Ш',
102 'y' => 'й', 'Y' => 'Й',
103 'ya' => 'я', 'Ya' => 'Я',
104 'ʼ' => 'ъ',
105 );
106
107 function loadDefaultTables() {
108 $this->mTables = array(
109 'uz-cyrl' => new ReplacementArray( $this->toCyrillic ),
110 'uz-latn' => new ReplacementArray( $this->toLatin ),
111 'uz' => new ReplacementArray()
112 );
113 }
114
115 }
116
117 /**
118 * Uzbek
119 *
120 * @ingroup Language
121 */
122 class LanguageUz extends Language {
123 function __construct() {
124 global $wgHooks;
125 parent::__construct();
126
127 $variants = array( 'uz', 'uz-latn', 'uz-cyrl' );
128 $variantfallbacks = array(
129 'uz' => 'uz-latn',
130 'uz-cyrl' => 'uz',
131 'uz-latn' => 'uz',
132 );
133
134 $this->mConverter = new UzConverter( $this, 'uz', $variants, $variantfallbacks );
135 $wgHooks['PageContentSaveComplete'][] = $this->mConverter;
136 }
137 }