MediaWiki  REL1_22
LanguageUz.php
Go to the documentation of this file.
00001 <?php
00024 require_once __DIR__ . '/../LanguageConverter.php';
00025 
00029 class UzConverter extends LanguageConverter {
00030     public $toLatin = array(
00031         'а' => 'a', 'А' => 'A',
00032         'б' => 'b', 'Б' => 'B',
00033         'д' => 'd', 'Д' => 'D',
00034         'е' => 'e', 'Е' => 'E',
00035         'э' => 'e', 'Э' => 'E',
00036         'в' => 'v', 'В' => 'V',
00037         'х' => 'x', 'Х' => 'X',
00038         'ғ' => 'gʻ', 'Ғ' => 'Gʻ',
00039         'г' => 'g', 'Г' => 'G',
00040         'ҳ' => 'h', 'Ҳ' => 'H',
00041         'ж' => 'j', 'Ж' => 'J',
00042         'з' => 'z', 'З' => 'Z',
00043         'и' => 'i', 'И' => 'I',
00044         'к' => 'k', 'К' => 'K',
00045         'л' => 'l', 'Л' => 'L',
00046         'м' => 'm', 'М' => 'M',
00047         'н' => 'n', 'Н' => 'N',
00048         'о' => 'o', 'О' => 'O',
00049         'п' => 'p', 'П' => 'P',
00050         'р' => 'r', 'Р' => 'R',
00051         'с' => 's', 'С' => 'S',
00052         'т' => 't', 'Т' => 'T',
00053         'у' => 'u', 'У' => 'U',
00054         'ф' => 'f', 'Ф' => 'F',
00055         'ц' => 'c', 'Ц' => 'C',
00056         'ў' => 'oʻ', 'Ў' => 'Oʻ',
00057         'ц' => 'ts', 'Ц' => 'Ts', // note: at the beginning of a word and right after a consonant, only "s" is used
00058         'қ' => 'q', 'Қ' => 'Q',
00059         'ё' => 'yo', 'Ё' => 'Yo',
00060         'ю' => 'yu', 'Ю' => 'Yu',
00061         'ч' => 'ch', 'Ч' => 'Ch',
00062         'ш' => 'sh', 'Ш' => 'Sh',
00063         'й' => 'y', 'Й' => 'Y',
00064         'я' => 'ya', 'Я' => 'Ya',
00065         'ъ' => 'ʼ',
00066     );
00067 
00068     public $toCyrillic = array(
00069         'a' => 'а', 'A' => 'А',
00070         'b' => 'б', 'B' => 'Б',
00071         'd' => 'д', 'D' => 'Д',
00072         'e' => 'е', 'E' => 'Е',
00073         ' e' => ' э', ' E' => ' Э', // "э" is used at the beginning of a word instead of "e"
00074         'ye' => 'е', 'Ye' => 'Е',
00075         'f' => 'ф', 'F' => 'Ф',
00076         'g' => 'г', 'G' => 'Г',
00077         'g‘' => 'ғ', 'G‘' => 'Ғ', 'gʻ' => 'ғ', 'Gʻ' => 'Ғ',
00078         'h' => 'ҳ', 'H' => 'Ҳ',
00079         'i' => 'и', 'I' => 'И',
00080         'k' => 'к', 'K' => 'К',
00081         'l' => 'л', 'L' => 'Л',
00082         'm' => 'м', 'M' => 'М',
00083         'n' => 'н', 'N' => 'Н',
00084         'o' => 'о', 'O' => 'О',
00085         'p' => 'п', 'P' => 'П',
00086         'r' => 'р', 'R' => 'Р',
00087         's' => 'с', 'S' => 'С',
00088         't' => 'т', 'T' => 'Т',
00089         'u' => 'у', 'U' => 'У',
00090         'v' => 'в', 'V' => 'В',
00091         'x' => 'х', 'X' => 'Х',
00092         'z' => 'з', 'Z' => 'З',
00093         'j' => 'ж', 'J' => 'Ж',
00094         'o‘' => 'ў', 'O‘' => 'Ў', 'oʻ' => 'ў', 'Oʻ' => 'Ў',
00095         'yo‘' => 'йў', 'Yo‘' => 'Йў', 'yoʻ' => 'йў', 'Yoʻ' => 'Йў',
00096         'ts' => 'ц', 'Ts' => 'Ц',
00097         'q' => 'қ', 'Q' => 'Қ',
00098         'yo' => 'ё', 'Yo' => 'Ё',
00099         'yu' => 'ю', 'Yu' => 'Ю',
00100         'ch' => 'ч', 'Ch' => 'Ч',
00101         'sh' => 'ш', 'Sh' => 'Ш',
00102         'y' => 'й', 'Y' => 'Й',
00103         'ya' => 'я', 'Ya' => 'Я',
00104         'ʼ' => 'ъ',
00105     );
00106 
00107     function loadDefaultTables() {
00108         $this->mTables = array(
00109             'uz-cyrl' => new ReplacementArray( $this->toCyrillic ),
00110             'uz-latn' => new ReplacementArray( $this->toLatin ),
00111             'uz' => new ReplacementArray()
00112         );
00113     }
00114 
00115 }
00116 
00122 class LanguageUz extends Language {
00123     function __construct() {
00124         global $wgHooks;
00125         parent::__construct();
00126 
00127         $variants = array( 'uz', 'uz-latn', 'uz-cyrl' );
00128         $variantfallbacks = array(
00129             'uz' => 'uz-latn',
00130             'uz-cyrl' => 'uz',
00131             'uz-latn' => 'uz',
00132         );
00133 
00134         $this->mConverter = new UzConverter( $this, 'uz', $variants, $variantfallbacks );
00135         $wgHooks['PageContentSaveComplete'][] = $this->mConverter;
00136     }
00137 }