24 require_once __DIR__ .
'/../LanguageConverter.php';
25 require_once __DIR__ .
'/LanguageKk_cyrl.php';
27 define(
'KK_C_UC',
'АӘБВГҒДЕЁЖЗИЙКҚЛМНҢОӨПРСТУҰҮФХҺЦЧШЩЪЫІЬЭЮЯ' ); # Kazakh Cyrillic uppercase
28 define(
'KK_C_LC',
'аәбвгғдеёжзийкқлмнңоөпрстуұүфхһцчшщъыіьэюя' ); # Kazakh Cyrillic lowercase
29 define(
'KK_L_UC',
'AÄBCÇDEÉFGĞHIİÏJKLMNÑOÖPQRSŞTUÜVWXYÝZ' ); # Kazakh Latin uppercase
30 define(
'KK_L_LC',
'aäbcçdeéfgğhıiïjklmnñoöpqrsştuüvwxyýz' ); # Kazakh Latin lowercase
32 define(
'H_HAMZA',
'ٴ' ); # U+0674 ARABIC LETTER HIGH HAMZA
53 $variantfallbacks =
array(),
55 parent::__construct( $langobj, $maincode,
56 $variants, $variantfallbacks,
$flags );
75 $this->mTables =
array(
87 $this->mTables[
'kk-kz']->merge( $this->mTables[
'kk-cyrl'] );
88 $this->mTables[
'kk-tr']->merge( $this->mTables[
'kk-latn'] );
89 $this->mTables[
'kk-cn']->merge( $this->mTables[
'kk-arab'] );
94 $this->mCyrl2Latn =
array(
98 '/([АӘЕЁИОӨҰҮЭЮЯЪЬ])Е/u' =>
'$1YE',
99 '/([АӘЕЁИОӨҰҮЭЮЯЪЬ])е/ui' =>
'$1ye',
101 '/^Ё([' .
KK_C_UC .
']|$)/u' =>
'YO$1',
'/^Ё([' .
KK_C_LC .
']|$)/u' =>
'Yo$1',
102 '/^Ю([' .
KK_C_UC .
']|$)/u' =>
'YU$1',
'/^Ю([' .
KK_C_LC .
']|$)/u' =>
'Yu$1',
103 '/^Я([' .
KK_C_UC .
']|$)/u' =>
'YA$1',
'/^Я([' .
KK_C_LC .
']|$)/u' =>
'Ya$1',
104 '/^Щ([' .
KK_C_UC .
']|$)/u' =>
'ŞÇ$1',
'/^Щ([' .
KK_C_LC .
']|$)/u' =>
'Şç$1',
106 '/Ё/u' =>
'YO',
'/ё/u' =>
'yo',
107 '/Ю/u' =>
'YU',
'/ю/u' =>
'yu',
108 '/Я/u' =>
'YA',
'/я/u' =>
'ya',
109 '/Щ/u' =>
'ŞÇ',
'/щ/u' =>
'şç',
110 # # soft and hard signs
111 '/[ъЪ]/u' =>
'ʺ',
'/[ьЬ]/u' =>
'ʹ',
113 '/А/u' =>
'A',
'/а/u' =>
'a',
'/Ә/u' =>
'Ä',
'/ә/u' =>
'ä',
114 '/Б/u' =>
'B',
'/б/u' =>
'b',
'/В/u' =>
'V',
'/в/u' =>
'v',
115 '/Г/u' =>
'G',
'/г/u' =>
'g',
'/Ғ/u' =>
'Ğ',
'/ғ/u' =>
'ğ',
116 '/Д/u' =>
'D',
'/д/u' =>
'd',
'/Е/u' =>
'E',
'/е/u' =>
'e',
117 '/Ж/u' =>
'J',
'/ж/u' =>
'j',
'/З/u' =>
'Z',
'/з/u' =>
'z',
118 '/И/u' =>
'Ï',
'/и/u' =>
'ï',
'/Й/u' =>
'Ý',
'/й/u' =>
'ý',
119 '/К/u' =>
'K',
'/к/u' =>
'k',
'/Қ/u' =>
'Q',
'/қ/u' =>
'q',
120 '/Л/u' =>
'L',
'/л/u' =>
'l',
'/М/u' =>
'M',
'/м/u' =>
'm',
121 '/Н/u' =>
'N',
'/н/u' =>
'n',
'/Ң/u' =>
'Ñ',
'/ң/u' =>
'ñ',
122 '/О/u' =>
'O',
'/о/u' =>
'o',
'/Ө/u' =>
'Ö',
'/ө/u' =>
'ö',
123 '/П/u' =>
'P',
'/п/u' =>
'p',
'/Р/u' =>
'R',
'/р/u' =>
'r',
124 '/С/u' =>
'S',
'/с/u' =>
's',
'/Т/u' =>
'T',
'/т/u' =>
't',
125 '/У/u' =>
'W',
'/у/u' =>
'w',
'/Ұ/u' =>
'U',
'/ұ/u' =>
'u',
126 '/Ү/u' =>
'Ü',
'/ү/u' =>
'ü',
'/Ф/u' =>
'F',
'/ф/u' =>
'f',
127 '/Х/u' =>
'X',
'/х/u' =>
'x',
'/Һ/u' =>
'H',
'/һ/u' =>
'h',
128 '/Ц/u' =>
'C',
'/ц/u' =>
'c',
'/Ч/u' =>
'Ç',
'/ч/u' =>
'ç',
129 '/Ш/u' =>
'Ş',
'/ш/u' =>
'ş',
'/Ы/u' =>
'I',
'/ы/u' =>
'ı',
130 '/І/u' =>
'İ',
'/і/u' =>
'i',
'/Э/u' =>
'É',
'/э/u' =>
'é',
133 $this->mLatn2Cyrl =
array(
137 '/ŞÇʹ/u' =>
'ЩЬ',
'/Şçʹ/u' =>
'Щь',
138 '/Ş[Çç]/u' =>
'Щ',
'/şç/u' =>
'щ',
139 # # soft and hard signs
141 '/ʺ([' .
KK_L_LC .
'])/u' =>
'ъ$1',
143 '/ʹ([' .
KK_L_LC .
'])/u' =>
'ь$1',
147 '/Y[Ee]/u' =>
'Е',
'/ye/u' =>
'е',
148 '/Y[Oo]/u' =>
'Ё',
'/yo/u' =>
'ё',
149 '/Y[UWuw]/u' =>
'Ю',
'/y[uw]/u' =>
'ю',
150 '/Y[Aa]/u' =>
'Я',
'/ya/u' =>
'я',
152 '/A/u' =>
'А',
'/a/u' =>
'а',
'/Ä/u' =>
'Ә',
'/ä/u' =>
'ә',
153 '/B/u' =>
'Б',
'/b/u' =>
'б',
'/C/u' =>
'Ц',
'/c/u' =>
'ц',
154 '/Ç/u' =>
'Ч',
'/ç/u' =>
'ч',
'/D/u' =>
'Д',
'/d/u' =>
'д',
155 '/E/u' =>
'Е',
'/e/u' =>
'е',
'/É/u' =>
'Э',
'/é/u' =>
'э',
156 '/F/u' =>
'Ф',
'/f/u' =>
'ф',
'/G/u' =>
'Г',
'/g/u' =>
'г',
157 '/Ğ/u' =>
'Ғ',
'/ğ/u' =>
'ғ',
'/H/u' =>
'Һ',
'/h/u' =>
'һ',
158 '/I/u' =>
'Ы',
'/ı/u' =>
'ы',
'/İ/u' =>
'І',
'/i/u' =>
'і',
159 '/Ï/u' =>
'И',
'/ï/u' =>
'и',
'/J/u' =>
'Ж',
'/j/u' =>
'ж',
160 '/K/u' =>
'К',
'/k/u' =>
'к',
'/L/u' =>
'Л',
'/l/u' =>
'л',
161 '/M/u' =>
'М',
'/m/u' =>
'м',
'/N/u' =>
'Н',
'/n/u' =>
'н',
162 '/Ñ/u' =>
'Ң',
'/ñ/u' =>
'ң',
'/O/u' =>
'О',
'/o/u' =>
'о',
163 '/Ö/u' =>
'Ө',
'/ö/u' =>
'ө',
'/P/u' =>
'П',
'/p/u' =>
'п',
164 '/Q/u' =>
'Қ',
'/q/u' =>
'қ',
'/R/u' =>
'Р',
'/r/u' =>
'р',
165 '/S/u' =>
'С',
'/s/u' =>
'с',
'/Ş/u' =>
'Ш',
'/ş/u' =>
'ш',
166 '/T/u' =>
'Т',
'/t/u' =>
'т',
'/U/u' =>
'Ұ',
'/u/u' =>
'ұ',
167 '/Ü/u' =>
'Ү',
'/ü/u' =>
'ү',
'/V/u' =>
'В',
'/v/u' =>
'в',
168 '/W/u' =>
'У',
'/w/u' =>
'у',
'/Ý/u' =>
'Й',
'/ý/u' =>
'й',
169 '/X/u' =>
'Х',
'/x/u' =>
'х',
'/Z/u' =>
'З',
'/z/u' =>
'з',
172 $this->mCyLa2Arab =
array(
173 # # Punctuation -> Arabic
174 '/#|№|No\./u' =>
'', # ؀
175 '/\,/' =>
'،', # ،
176 '/;/' =>
'؛', # ؛
177 '/\?/' =>
'؟', # ؟
178 '/%/' =>
'٪', # ٪
179 '/\*/' =>
'٭', # ٭
181 '/0/' =>
'۰', # ۰
182 '/1/' =>
'۱', # ۱
183 '/2/' =>
'۲', # ۲
184 '/3/' =>
'۳', # ۳
185 '/4/' =>
'۴', # ۴
186 '/5/' =>
'۵', # ۵
187 '/6/' =>
'۶', # ۶
188 '/7/' =>
'۷', # ۷
189 '/8/' =>
'۸', # ۸
190 '/9/' =>
'۹', # ۹
191 # # Cyrillic -> Arabic
193 '/([АӘЕЁИОӨҰҮЭЮЯЪЬ])е/ui' =>
'$1يە',
194 '/[еэ]/ui' =>
'ە',
'/[ъь]/ui' =>
'',
195 '/[аә]/ui' =>
'ا',
'/[оө]/ui' =>
'و',
'/[ұү]/ui' =>
'ۇ',
'/[ыі]/ui' =>
'ى',
196 '/[и]/ui' =>
'ىي',
'/ё/ui' =>
'يو',
'/ю/ui' =>
'يۋ',
'/я/ui' =>
'يا',
'/[й]/ui' =>
'ي',
197 '/ц/ui' =>
'تس',
'/щ/ui' =>
'شش',
198 '/һ/ui' =>
'ح',
'/ч/ui' =>
'تش',
199 # '/һ/ui' => 'ھ', '/ч/ui' => 'چ',
200 '/б/ui' =>
'ب',
'/в/ui' =>
'ۆ',
'/г/ui' =>
'گ',
'/ғ/ui' =>
'ع',
201 '/д/ui' =>
'د',
'/ж/ui' =>
'ج',
'/з/ui' =>
'ز',
'/к/ui' =>
'ك',
202 '/қ/ui' =>
'ق',
'/л/ui' =>
'ل',
'/м/ui' =>
'م',
'/н/ui' =>
'ن',
203 '/ң/ui' =>
'ڭ',
'/п/ui' =>
'پ',
'/р/ui' =>
'ر',
'/с/ui' =>
'س',
204 '/т/ui' =>
'ت',
'/у/ui' =>
'ۋ',
'/ф/ui' =>
'ف',
'/х/ui' =>
'ح',
206 # # Latin -> Arabic // commented for now...
235 if ( in_array(
'T',
$flags ) ) {
236 return parent::parseManualRule( $rule,
$flags );
241 foreach ( $this->mVariants
as $v ) {
260 if ( is_object( $nt ) ) {
261 $ns = $nt->getNamespace();
268 parent::findVariantLink(
$link, $nt, $ignoreOtherCond );
269 if ( $this->getPreferredVariant() == $this->mMainLanguageCode ) {
287 if ( preg_match(
"/^$imagename:/", $text ) ) {
291 return parent::autoConvert( $text, $toVariant );
306 switch ( $toVariant ) {
310 $wgLanguageCode =
'kk';
315 $wgLanguageCode =
'kk-Latn';
320 $wgLanguageCode =
'kk-Arab';
323 $wgLanguageCode =
'kk';
327 $varsfix =
'\$[0-9]';
329 $matches = preg_split(
'/' . $varsfix .
'[^' . $letters .
']+/u', $text, -1, PREG_SPLIT_OFFSET_CAPTURE );
333 $ret .= substr( $text, $mstart, $m[1] -$mstart );
335 $mstart = $m[1] + strlen( $m[0] );
350 switch ( $toVariant ) {
355 $excludes =
'еэгғкқЕЭГҒКҚ';
357 $matches = preg_split(
'/[\b\s\-\.:]+/', $text, -1, PREG_SPLIT_OFFSET_CAPTURE );
361 $ret .= substr( $text, $mstart, $m[1] - $mstart );
365 if ( preg_match(
'/[' . $front .
']/u', $m[0] ) && !preg_match(
'/[' . $excludes .
']/u', $m[0] ) ) {
366 $ret .= preg_replace(
'/[' . $letters .
']+/u',
H_HAMZA .
'$0', $m[0] );
370 $mstart = $m[1] + strlen( $m[0] );
373 foreach ( $this->mCyLa2Arab
as $pat => $rep ) {
374 $text = preg_replace( $pat, $rep, $text );
380 foreach ( $this->mCyrl2Latn
as $pat => $rep ) {
381 $text = preg_replace( $pat, $rep, $text );
387 foreach ( $this->mLatn2Cyrl
as $pat => $rep ) {
388 $text = preg_replace( $pat, $rep, $text );
417 parent::__construct();
419 $variants =
array(
'kk',
'kk-cyrl',
'kk-latn',
'kk-arab',
'kk-kz',
'kk-tr',
'kk-cn' );
420 $variantfallbacks =
array(
425 'kk-kz' =>
'kk-cyrl',
426 'kk-tr' =>
'kk-latn',
430 $this->mConverter =
new KkConverter( $this,
'kk', $variants, $variantfallbacks );
444 if ( ( $variant ==
'kk-latn' || $variant ==
'kk-tr' ) && $string[0] ==
'i' ) {
445 $string =
'İ' . substr( $string, 1 );
447 $string = parent::ucfirst( $string );
461 if ( ( $variant ==
'kk-latn' || $variant ==
'kk-tr' ) && $string[0] ==
'I' ) {
462 $string =
'ı' . substr( $string, 1 );
464 $string = parent::lcfirst( $string );
478 switch ( $variant ) {
481 $word = parent::convertGrammarKk_arab( $word, $case );
485 $word = parent::convertGrammarKk_latn( $word, $case );
491 $word = parent::convertGrammarKk_cyrl( $word, $case );