MediaWiki  1.23.2
LanguageUz.php
Go to the documentation of this file.
1 <?php
24 require_once __DIR__ . '/../LanguageConverter.php';
25 
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  // note: at the beginning of a word and right after a consonant, only "s" is used
58  'ц' => 'ts', 'Ц' => 'Ts',
59  'қ' => 'q', 'Қ' => 'Q',
60  'ё' => 'yo', 'Ё' => 'Yo',
61  'ю' => 'yu', 'Ю' => 'Yu',
62  'ч' => 'ch', 'Ч' => 'Ch',
63  'ш' => 'sh', 'Ш' => 'Sh',
64  'й' => 'y', 'Й' => 'Y',
65  'я' => 'ya', 'Я' => 'Ya',
66  'ъ' => 'ʼ',
67  );
68 
69  public $toCyrillic = array(
70  'a' => 'а', 'A' => 'А',
71  'b' => 'б', 'B' => 'Б',
72  'd' => 'д', 'D' => 'Д',
73  // at the beginning of a word and after a vowel, "э" is used instead of "e"
74  // (see regex below)
75  'e' => 'э', 'E' => 'Э',
76  'f' => 'ф', 'F' => 'Ф',
77  'g' => 'г', 'G' => 'Г',
78  'g‘' => 'ғ', 'G‘' => 'Ғ', 'gʻ' => 'ғ', 'Gʻ' => 'Ғ',
79  'h' => 'ҳ', 'H' => 'Ҳ',
80  'i' => 'и', 'I' => 'И',
81  'k' => 'к', 'K' => 'К',
82  'l' => 'л', 'L' => 'Л',
83  'm' => 'м', 'M' => 'М',
84  'n' => 'н', 'N' => 'Н',
85  'o' => 'о', 'O' => 'О',
86  'p' => 'п', 'P' => 'П',
87  'r' => 'р', 'R' => 'Р',
88  's' => 'с', 'S' => 'С',
89  't' => 'т', 'T' => 'Т',
90  'u' => 'у', 'U' => 'У',
91  'v' => 'в', 'V' => 'В',
92  'x' => 'х', 'X' => 'Х',
93  'z' => 'з', 'Z' => 'З',
94  'j' => 'ж', 'J' => 'Ж',
95  'o‘' => 'ў', 'O‘' => 'Ў', 'oʻ' => 'ў', 'Oʻ' => 'Ў',
96  'yo‘' => 'йў', 'Yo‘' => 'Йў', 'yoʻ' => 'йў', 'Yoʻ' => 'Йў',
97  'ts' => 'ц', 'Ts' => 'Ц',
98  'q' => 'қ', 'Q' => 'Қ',
99  'yo' => 'ё', 'Yo' => 'Ё',
100  'yu' => 'ю', 'Yu' => 'Ю',
101  'ch' => 'ч', 'Ch' => 'Ч',
102  'sh' => 'ш', 'Sh' => 'Ш',
103  'y' => 'й', 'Y' => 'Й',
104  'ya' => 'я', 'Ya' => 'Я',
105  'ʼ' => 'ъ',
106  );
107 
108  function loadDefaultTables() {
109  $this->mTables = array(
110  'uz-cyrl' => new ReplacementArray( $this->toCyrillic ),
111  'uz-latn' => new ReplacementArray( $this->toLatin ),
112  'uz' => new ReplacementArray()
113  );
114  }
115 
116  function translate( $text, $toVariant ) {
117  if ( $toVariant == 'uz-cyrl' ) {
118  $text = str_replace( 'ye', 'е', $text );
119  $text = str_replace( 'Ye', 'Е', $text );
120  $text = str_replace( 'YE', 'Е', $text );
121  // "е" after consonants, otherwise "э" (see above)
122  $text = preg_replace( '/([BVGDJZYKLMNPRSTFXCWQʻ‘H])E/u', '$1Е', $text );
123  $text = preg_replace( '/([bvgdjzyklmnprstfxcwqʻ‘h])e/ui', '$1е', $text );
124  }
125  return parent::translate( $text, $toVariant );
126  }
127 
128 }
129 
135 class LanguageUz extends Language {
136  function __construct() {
138  parent::__construct();
139 
140  $variants = array( 'uz', 'uz-latn', 'uz-cyrl' );
141  $variantfallbacks = array(
142  'uz' => 'uz-latn',
143  'uz-cyrl' => 'uz',
144  'uz-latn' => 'uz',
145  );
146 
147  $this->mConverter = new UzConverter( $this, 'uz', $variants, $variantfallbacks );
148  $wgHooks['PageContentSaveComplete'][] = $this->mConverter;
149  }
150 }
php
skin txt MediaWiki includes four core it has been set as the default in MediaWiki since the replacing Monobook it had been been the default skin since before being replaced by Vector largely rewritten in while keeping its appearance Several legacy skins were removed in the as the burden of supporting them became too heavy to bear Those in etc for skin dependent CSS etc for skin dependent JavaScript These can also be customised on a per user by etc This feature has led to a wide variety of user styles becoming that gallery is a good place to ending in php
Definition: skin.txt:62
LanguageUz\__construct
__construct()
Definition: LanguageUz.php:136
Language\$mConverter
LanguageConverter $mConverter
Definition: Language.php:78
$wgHooks
$wgHooks['ArticleShow'][]
Definition: hooks.txt:110
UzConverter\$toCyrillic
$toCyrillic
Definition: LanguageUz.php:69
UzConverter
Definition: LanguageUz.php:29
array
the array() calling protocol came about after MediaWiki 1.4rc1.
List of Api Query prop modules.
global
when a variable name is used in a it is silently declared as a new masking the global
Definition: design.txt:93
ReplacementArray
Replacement array for FSS with fallback to strtr() Supports lazy initialisation of FSS resource.
Definition: StringUtils.php:411
LanguageUz
Uzbek.
Definition: LanguageUz.php:135
UzConverter\$toLatin
$toLatin
Definition: LanguageUz.php:30
UzConverter\translate
translate( $text, $toVariant)
Definition: LanguageUz.php:116
Makefile.translate
def translate(text, conv_table)
Definition: Makefile.py:216
UzConverter\loadDefaultTables
loadDefaultTables()
Definition: LanguageUz.php:108
Language
Internationalisation code.
Definition: Language.php:74