Index: trunk/phase3/languages/LanguageConverter.php |
— | — | @@ -21,7 +21,7 @@ |
22 | 22 | var $mFlags; |
23 | 23 | var $mUcfirst = false; |
24 | 24 | |
25 | | - const CACHE_VERSION_KEY = 'VERSION 4'; |
| 25 | + const CACHE_VERSION_KEY = 'VERSION 5'; |
26 | 26 | |
27 | 27 | /** |
28 | 28 | * Constructor |
— | — | @@ -811,5 +811,3 @@ |
812 | 812 | |
813 | 813 | |
814 | 814 | } |
815 | | - |
816 | | - |
Index: trunk/phase3/languages/messages/MessagesKk.php |
— | — | @@ -15,80 +15,11 @@ |
16 | 16 | 'linkprefix' => '/^(.*?)([a-zäçéğıïñöşüýа-яёәіңғүұқөһA-ZÄÇÉĞİÏÑÖŞÜÝА-ЯЁӘІҢҒҮҰҚӨҺاٵبۆگعدەجزيكقلمنڭوٶپرستۋۇٷفحھچشىٸʺʹ«„]+)$/sDu', |
17 | 17 | |
18 | 18 | # Stylesheets |
19 | | -'common.css' => ' /* Мындағы CSS барлық безендіру мәнеріндерде қолданылады */', |
20 | | -'monobook.css' => ' /* Мындағы CSS «Дара кітап» (monobook) безендіру мәнерін пайдаланушыларға ықпал етеді */', |
| 19 | +'common.css' => '/* Мындағы CSS барлық безендіру мәнеріндерде қолданылады */', |
| 20 | +'monobook.css' => '/* Мындағы CSS «Дара кітап» (monobook) безендіру мәнерін пайдаланушыларға ықпал етеді */', |
21 | 21 | |
22 | 22 | # Scripts |
23 | | -'common.js' => ' /* Мындағы JavaScript әрқайсы бет қаралғанда барлық пайдаланушыларға жүктеледі. */ |
24 | | - |
25 | | -/* Workaround for language variants */ |
26 | | -var languagevariant; |
27 | | -var direction; |
28 | | -switch(wgUserLanguage){ |
29 | | - case "kk": |
30 | | - languagevariant = "kk"; |
31 | | - direction = "ltr"; |
32 | | - break; |
33 | | - case "kk-kz": |
34 | | - case "kk-cyrl": |
35 | | - languagevariant = "kk-Cyrl"; |
36 | | - direction = "ltr"; |
37 | | - break; |
38 | | - case "kk-tr": |
39 | | - case "kk-latn": |
40 | | - languagevariant = "kk-Latn"; |
41 | | - direction = "ltr"; |
42 | | - break; |
43 | | - case "kk-cn": |
44 | | - case "kk-arab": |
45 | | - // workaround for RTL ([[bugzilla:6756]]) and for [[bugzilla:02020]] & [[bugzilla:04295]] |
46 | | - languagevariant = "kk-Arab"; |
47 | | - direction = "rtl"; |
48 | | - document.getElementsByTagName("body").className = "rtl"; |
49 | | - switch(skin){ |
50 | | - case "monobook": |
51 | | - document.write(\'<link rel="stylesheet" type="text/css" href="\'+stylepath+\'/monobook/rtl.css">\'); |
52 | | - document.write(\'<style type="text/css">body{font-size: 75%; letter-spacing: 0.001em;} h3{font-size:110%;} h4 {font-size:100%;} h5{font-size:90%;} html > body div#content ol{clear: left;} ol{margin-left:2.4em; margin-right:2.4em;} ul{margin-left:1.5em; margin-right:1.5em;} .editsection{margin-right:5px; margin-left:0;} #column-one{padding-top:0; margin-top:0;} #p-navigation{padding-top:0; margin-top:160px;} #catlinks{width:100%;} #userloginForm{float: right !important;} .pBody{-moz-border-radius-topleft: 0.5em; -moz-border-radius-topright: 0em !important;} .portlet h5{clear:right;}</style>\'); |
53 | | - break; |
54 | | - case "chick": |
55 | | - document.write(\'<link rel="stylesheet" type="text/css" href="\'+stylepath+\'/monobook/rtl.css">\'); |
56 | | - document.write(\'<style type="text/css">body{font-size: 75%; letter-spacing: 0.001em;} h3{font-size:110%;} h4 {font-size:100%;} h5{font-size:90%;} html > body div#content ol{clear: left;} ol{margin-left:2.4em; margin-right:2.4em;} ul{margin-left:1.5em; margin-right:1.5em;} .editsection{margin-right:5px; margin-left:0;} #column-one{clear:left !important; text-align:right; padding-top:0; margin-top:0;} #p-personal {float:right !important; text-align:right;} #userloginForm{float: right !important;} .pBody{-moz-border-radius-topleft: 0.5em; -moz-border-radius-topright: 0em !important;} .portlet h5{clear:right;}</style>\'); |
57 | | - break; |
58 | | - case "simple": |
59 | | - document.write(\'<link rel="stylesheet" type="text/css" href="\'+stylepath+\'/monobook/rtl.css">\'); |
60 | | - document.write(\'<style type="text/css">body{font-size: 75%; letter-spacing: 0.001em;} h3{font-size:110%;} h4 {font-size:100%;} h5{font-size:90%;} html > body div#content ol{clear: left;} ol{margin-left:2.4em; margin-right:2.4em;} ul{margin-left:1.5em; margin-right:1.5em;} .editsection{margin-right:5px; margin-left:0;} #column-one{float:right !important; margin-right: 0 !important; text-align:right; padding-top:0; margin-top:0;} #p-cactions, #p-personal {float:right !important; text-align:right;} #userloginForm{float: right !important;} .pBody{-moz-border-radius-topleft: 0.5em; -moz-border-radius-topright: 0em !important;} .portlet h5{clear:right;}</style>\'); |
61 | | - break; |
62 | | - case "myskin": |
63 | | - document.write(\'<link rel="stylesheet" type="text/css" href="\'+stylepath+\'/monobook/rtl.css">\'); |
64 | | - document.write(\'<style type="text/css">body{font-size: 75%; letter-spacing: 0.001em;} h3{font-size:110%;} h4 {font-size:100%;} h5{font-size:90%;} html > body div#content ol{clear: left;} ol{margin-left:2.4em; margin-right:2.4em;} ul{margin-left:1.5em; margin-right:1.5em;} .editsection{margin-right:5px; margin-left:0;} #column-one{clear:left !important; text-align:right; padding-top:0; margin-top:0;} #userloginForm{float: right !important;} .pBody{-moz-border-radius-topleft: 0.5em; -moz-border-radius-topright: 0em !important;} .portlet h5{clear:right;}</style>\'); |
65 | | - break; |
66 | | - case "cologneblue": |
67 | | - document.write(\'<link rel="stylesheet" type="text/css" href="\'+stylepath+\'/common/common_rtl.css">\'); |
68 | | - document.write(\'<link rel="stylesheet" type="text/css" href="\'+stylepath+\'/common/quickbar-right.css">\'); |
69 | | - document.write(\'<style type="text/css">#article {float: left !important; margin-left: 0 !important; margin-right:140px !important;} #quickbar {clear:left;}<style>\'); |
70 | | - break; |
71 | | - case "nostalgia": |
72 | | - document.write(\'<link rel="stylesheet" type="text/css" href="\'+stylepath+\'/common/common_rtl.css">\'); |
73 | | - document.write(\'<style type="text/css">#topbar a img {float: left !important;}<style>\'); |
74 | | - break; |
75 | | - case "standard": |
76 | | - document.write(\'<link rel="stylesheet" type="text/css" href="\'+stylepath+\'/common/common_rtl.css">\'); |
77 | | - document.write(\'<link rel="stylesheet" type="text/css" href="\'+stylepath+\'/common/quickbar-right.css">\'); |
78 | | - document.write(\'<style type="text/css">#article {float: left !important; margin-left: 0 !important; margin-right:140px !important;} #quickbar {clear:left;} .bottom {text-align:right;}<style>\'); |
79 | | - break; |
80 | | - default: |
81 | | - } |
82 | | - document.write(\'<style type="text/css">div#shared-image-desc {direction: ltr;} input#wpUploadFile, input#wpDestFile, input#wpLicense {float: right;} .editsection {float: left !important;} .infobox {float: left !important; clear:left; } div.floatleft, table.floatleft {float:right !important; margin-left:0.5em !important; margin-right:0 !important; } div.floatright, table.floatright {clear:left; float:left !important; margin-left:0 !important; margin-right:0.5em !important;}</style>\'); |
83 | | - break; |
84 | | - default: |
85 | | - languagevariant = "kk"; |
86 | | - direction = "ltr"; |
87 | | -} |
88 | | - |
89 | | -var htmlE=document.documentElement; |
90 | | -htmlE.setAttribute("lang",languagevariant); |
91 | | -htmlE.setAttribute("xml:lang",languagevariant); |
92 | | -htmlE.setAttribute("dir",direction);', |
| 23 | +'common.js' => '/* Мындағы JavaScript әрқайсы бет қаралғанда барлық пайдаланушыларға жүктеледі. */', |
93 | 24 | 'monobook.js' => ' /* Тыйылған; орнына [[{{ns:mediawiki}}:common.js]] қолданыңыз */', |
94 | 25 | |
95 | 26 | /* |
— | — | @@ -97,12 +28,12 @@ |
98 | 29 | * 'variantname-kk-cn' => 'disable', |
99 | 30 | */ |
100 | 31 | # Variants for Kazakh language |
101 | | -'variantname-kk-kz' => 'disable', # Қазақстан |
102 | | -'variantname-kk-tr' => 'disable', # Türkïya |
103 | | -'variantname-kk-cn' => 'disable', # جۇنگو |
| 32 | +'variantname-kk-kz' => 'disable', # Қазақстан |
| 33 | +'variantname-kk-tr' => 'disable', # Türkïya |
| 34 | +'variantname-kk-cn' => 'disable', # جۇنگو |
104 | 35 | 'variantname-kk-cyrl' => 'Кирил', |
105 | 36 | 'variantname-kk-latn' => 'Latın', |
106 | 37 | 'variantname-kk-arab' => 'توتە', |
107 | | -'variantname-kk' => 'disable', |
| 38 | +'variantname-kk' => 'disable', |
108 | 39 | |
109 | 40 | ); |
Index: trunk/phase3/languages/messages/MessagesKk_cyrl.php |
— | — | @@ -901,8 +901,8 @@ |
902 | 902 | 'accmailtitle' => 'Құпия сөз жіберілді.', |
903 | 903 | 'accmailtext' => '$2 жайына «$1» құпия сөзі жіберілді.', |
904 | 904 | 'newarticle' => '(Жаңа)', |
905 | | -'newarticletext' => 'Сілтемеге еріп әлі басталмаған бетке |
906 | | -келіпсіз. Бетті бастау үшін, төмендегі аумақта мәтініңізді теріңіз |
| 905 | +'newarticletext' => 'Сілтемеге еріп әлі басталмаған бетке келіпсіз. |
| 906 | +Бетті бастау үшін, төмендегі аумақта мәтініңізді теріңіз |
907 | 907 | (көбірек ақпарат үшін [[{{{{ns:mediawiki}}:helppage}}|анықтама бетін]] қараңыз). |
908 | 908 | Егер жаңылғаннан осында келген болсаңыз, шолғышыңыз «Артқа» деген батырмасын нұқыңыз.', |
909 | 909 | 'anontalkpagetext' => "----''Бұл тіркелгісіз (немесе тіркелгісін қолданбаған) қатысушы талқылау беті. Осы қатысушыны біз тек сандық IP жайымен теңдестіреміз. Осындай IP жайлар бірнеше қатысушыға ортақ болуы мүмкін. Егер сіз тіркелгісіз қатысушы болсаңыз және сізге қатыссыз мәндемелер жіберілгенін сезсеңіз, басқа тіркелгісіз қатысушылармен араластырмауы үшін [[{{ns:special}}:Userlogin|тіркеліңіз не кіріңіз]].''", |
— | — | @@ -1295,6 +1295,8 @@ |
1296 | 1296 | 'illegalfilename' => '«$1» файл атауында бет атауларында рұқсат етілмеген нышандар бар. Файлды қайта атаңыз да бұны жуктеді қайта байқап көріңіз.', |
1297 | 1297 | 'badfilename' => 'Файлдың аты «$1» боп өзгертілді.', |
1298 | 1298 | 'filetype-badmime' => '«$1» деген MIME түрі бар файлдарды қотаруға рұқсат етілмейді.', |
| 1299 | +'filetype-badtype' => "'''«.$1»''' деген күтілмеген файл түрі |
| 1300 | +: Рүқсат етілген файл түр тізімі: $2", |
1299 | 1301 | 'filetype-missing' => 'Бұл файлдың («.jpg» сияқты) кеңейтімі жоқ.', |
1300 | 1302 | 'large-file' => 'Файлды $1 мөлшерден аспауына тырысыңыз; бұл файл мөлшері — $2.', |
1301 | 1303 | 'largefileserver' => 'Осы файлдың мөлшері сервердің қалауынан асып кеткен.', |
Index: trunk/phase3/languages/messages/MessagesKk_latn.php |
— | — | @@ -1296,6 +1296,8 @@ |
1297 | 1297 | 'illegalfilename' => '«$1» faýl atawında bet atawlarında ruqsat etilmegen nışandar bar. Faýldı qaýta atañız da bunı jwktedi qaýta baýqap köriñiz.', |
1298 | 1298 | 'badfilename' => 'Faýldıñ atı «$1» bop özgertildi.', |
1299 | 1299 | 'filetype-badmime' => '«$1» degen MIME türi bar faýldardı qotarwğa ruqsat etilmeýdi.', |
| 1300 | +'filetype-badtype' => "'''«.$1»''' degen kütilmegen faýl türi |
| 1301 | +: Rüqsat etilgen faýl tür tizimi: $2", |
1300 | 1302 | 'filetype-missing' => 'Bul faýldıñ («.jpg» sïyaqtı) keñeýtimi joq.', |
1301 | 1303 | 'large-file' => 'Faýldı $1 mölşerden aspawına tırısıñız; bul faýl mölşeri — $2.', |
1302 | 1304 | 'largefileserver' => 'Osı faýldıñ mölşeri serverdiñ qalawınan asıp ketken.', |
Index: trunk/phase3/languages/messages/MessagesKk_arab.php |
— | — | @@ -15,9 +15,22 @@ |
16 | 16 | $fallback = 'kk-cyrl'; |
17 | 17 | $rtl = true; |
18 | 18 | |
| 19 | +$digitTransformTable = array( |
| 20 | + '0' => '۰', # ۰ |
| 21 | + '1' => '۱', # ۱ |
| 22 | + '2' => '۲', # ۲ |
| 23 | + '3' => '۳', # ۳ |
| 24 | + '4' => '۴', # ۴ |
| 25 | + '5' => '۵', # ۵ |
| 26 | + '6' => '۶', # ۶ |
| 27 | + '7' => '۷', # ۷ |
| 28 | + '8' => '۸', # ۸ |
| 29 | + '9' => '۹', # ۹ |
| 30 | +); |
| 31 | + |
19 | 32 | $separatorTransformTable = array( |
20 | | - ',' => "\xc2\xa0", |
21 | | - '.' => ',', |
| 33 | + ',' => '٬', # ٬ |
| 34 | + '.' => '٫', # ٫ |
22 | 35 | ); |
23 | 36 | |
24 | 37 | $defaultUserOptionOverrides = array( |
— | — | @@ -129,30 +142,31 @@ |
130 | 143 | ); |
131 | 144 | |
132 | 145 | $dateFormats = array( |
133 | | - 'mdy time' => 'H:i', |
134 | | - 'mdy date' => 'xg j, Y "ج."', |
135 | | - 'mdy both' => 'H:i, xg j, Y "ج."', |
| 146 | + ## Please be cautious not to delete the invisible RLM from the beginning of the strings. |
| 147 | + 'mdy time' => 'H:i', |
| 148 | + 'mdy date' => 'xg j، Y "ج."', |
| 149 | + 'mdy both' => 'H:i، xg j، Y "ج."', |
136 | 150 | |
137 | | - 'dmy time' => 'H:i', |
138 | | - 'dmy date' => 'j F, Y "ج."', |
139 | | - 'dmy both' => 'H:i, j F, Y "ج."', |
| 151 | + 'dmy time' => 'H:i', |
| 152 | + 'dmy date' => 'j F, Y "ج."', |
| 153 | + 'dmy both' => 'H:i، j F، Y "ج."', |
140 | 154 | |
141 | | - 'ymd time' => 'H:i', |
142 | | - 'ymd date' => 'Y "ج." xg j', |
143 | | - 'ymd both' => 'H:i, Y "ج." xg j', |
| 155 | + 'ymd time' => 'H:i', |
| 156 | + 'ymd date' => 'Y "ج." xg j', |
| 157 | + 'ymd both' => 'H:i، Y "ج." xg j', |
144 | 158 | |
145 | 159 | 'yyyy-mm-dd time' => 'xnH:xni:xns', |
146 | 160 | 'yyyy-mm-dd date' => 'xnY-xnm-xnd', |
147 | 161 | 'yyyy-mm-dd both' => 'xnH:xni:xns, xnY-xnm-xnd', |
148 | 162 | |
149 | | - 'persian time' => 'H:i', |
150 | | - 'persian date' => 'xij xiF xiY', |
151 | | - 'persian both' => 'xij xiF xiY, H:i', |
152 | | - |
153 | | - 'hebrew time' => 'H:i', |
154 | | - 'hebrew date' => 'xij xjF xjY', |
155 | | - 'hebrew both' => 'H:i, xij xjF xjY', |
| 163 | + 'persian time' => 'H:i', |
| 164 | + 'persian date' => 'xij xiF xiY', |
| 165 | + 'persian both' => 'xij xiF xiY, H:i', |
156 | 166 | |
| 167 | + 'hebrew time' => 'H:i', |
| 168 | + 'hebrew date' => 'xij xjF xjY', |
| 169 | + 'hebrew both' => 'H:i, xij xjF xjY', |
| 170 | + |
157 | 171 | 'ISO 8601 time' => 'xnH:xni:xns', |
158 | 172 | 'ISO 8601 date' => 'xnY-xnm-xnd', |
159 | 173 | 'ISO 8601 both' => 'xnY-xnm-xnd"T"xnH:xni:xns', |
— | — | @@ -1304,6 +1318,8 @@ |
1305 | 1319 | 'illegalfilename' => '«$1» فايل اتاۋىندا بەت اتاۋلارىندا رۇقسات ەتٸلمەگەن نىشاندار بار. فايلدى قايتا اتاڭىز دا بۇنى جۋكتەدٸ قايتا بايقاپ كٶرٸڭٸز.', |
1306 | 1320 | 'badfilename' => 'فايلدىڭ اتى «$1» بوپ ٶزگەرتٸلدٸ.', |
1307 | 1321 | 'filetype-badmime' => '«$1» دەگەن MIME تٷرٸ بار فايلداردى قوتارۋعا رۇقسات ەتٸلمەيدٸ.', |
| 1322 | +'filetype-badtype' => "'''«.$1»''' دەگەن كٷتٸلمەگەن فايل تٷرٸ |
| 1323 | +: رٷقسات ەتٸلگەن فايل تٷر تٸزٸمٸ: $2", |
1308 | 1324 | 'filetype-missing' => 'بۇل فايلدىڭ («.jpg» سيياقتى) كەڭەيتٸمٸ جوق.', |
1309 | 1325 | 'large-file' => 'فايلدى $1 مٶلشەردەن اسپاۋىنا تىرىسىڭىز; بۇل فايل مٶلشەرٸ — $2.', |
1310 | 1326 | 'largefileserver' => 'وسى فايلدىڭ مٶلشەرٸ سەرۆەردٸڭ قالاۋىنان اسىپ كەتكەن.', |
Index: trunk/phase3/languages/classes/LanguageKk.php |
— | — | @@ -8,137 +8,173 @@ |
9 | 9 | require_once( dirname(__FILE__).'/../LanguageConverter.php' ); |
10 | 10 | require_once( dirname(__FILE__).'/LanguageKk_cyrl.php' ); |
11 | 11 | |
| 12 | +define( 'KK_C_UC', 'АӘБВГҒДЕЁЖЗИЙКҚЛМНҢОӨПРСТУҰҮФХҺЦЧШЩЪЫІЬЭЮЯ' ); # Kazakh Cyrillic uppercase |
| 13 | +define( 'KK_C_LC', 'аәбвгғдеёжзийкқлмнңоөпрстуұүфхһцчшщъыіьэюя' ); # Kazakh Cyrillic lowercase |
| 14 | +define( 'KK_L_UC', 'AÄBCÇDEÉFGĞHIİÏJKLMNÑOÖPQRSŞTUÜVWXYÝZ' ); # Kazakh Latin uppercase |
| 15 | +define( 'KK_L_LC', 'aäbcçdeéfgğhıiïjklmnñoöpqrsştuüvwxyýz' ); # Kazakh Latin lowercase |
| 16 | +define( 'KK_A', 'اٵبۆگعدەجزيكقلمنڭوٶپرستۋۇٷفحھچشىٸ' ); # Kazakh Arabic |
| 17 | + |
12 | 18 | class KkConverter extends LanguageConverter { |
13 | | - var $mLatinToCyrillic = array( |
14 | | - 'YA' => 'Я', 'Ya' => 'Я', 'ya' => 'я', 'YE' => 'Е', 'Ye' => 'У', 'ye' => 'е', |
15 | | - 'YO' => 'Ё', 'Yo' => 'Ё', 'yo' => 'ё', 'YU' => 'Ю', 'Yu' => 'Ю', 'yu' => 'ю', |
16 | | - 'YW' => 'Ю', 'Yw' => 'Ю', 'yw' => 'ю', |
17 | 19 | |
18 | | - 'bʺ' => 'бъ', 'dʺ' => 'дъ', 'fʺ' => 'фъ', 'gʺ' => 'гъ', 'kʺ' => 'къ', 'lʺ' => 'лъ', |
19 | | - 'mʺ' => 'мъ', 'nʺ' => 'нъ', 'pʺ' => 'пъ', 'rʺ' => 'ръ', 'sʺ' => 'съ', 'tʺ' => 'тъ', |
20 | | - 'vʺ' => 'въ', 'zʺ' => 'зъ', |
21 | | - /* 'jʺ' => 'жъ', 'cʺ' => 'цъ', 'çʺ' => 'чъ', 'şʺ' => 'шъ', */ |
| 20 | + function loadDefaultTables() { |
| 21 | + // require( dirname(__FILE__)."/../../includes/KkConversion.php" ); |
| 22 | + // Placeholder for future implementing. Remove variables declarations |
| 23 | + // after generating KkConversion.php |
| 24 | + $kk2Cyrl = array(); |
| 25 | + $kk2Latn = array(); |
| 26 | + $kk2Arab = array(); |
| 27 | + $kk2KZ = array(); |
| 28 | + $kk2TR = array(); |
| 29 | + $kk2CN = array(); |
22 | 30 | |
23 | | - 'ŞÇʹ'=> 'ЩЬ', 'Şçʹ'=> 'Щь', 'Bʺ' => 'БЪ', 'Dʺ' => 'ДЪ', 'Fʺ' => 'ФЪ', 'Gʺ' => 'ГЪ', 'Kʺ' => 'КЪ', 'Lʺ' => 'ЛЪ', |
24 | | - 'Mʺ' => 'МЪ', 'Nʺ' => 'НЪ', 'Pʺ' => 'ПЪ', 'Rʺ' => 'РЪ', 'Sʺ' => 'СЪ', 'Tʺ' => 'ТЪ', |
25 | | - 'Vʺ' => 'ВЪ', 'Zʺ' => 'ЗЪ', |
26 | | - /* 'Jʺ' => 'ЖЪ', 'Cʺ' => 'ЦЪ', 'Çʺ' => 'ЧЪ', 'Şʺ' => 'ШЪ', */ |
| 31 | + $this->mTables = array( |
| 32 | + 'kk-cyrl' => new ReplacementArray( $kk2Cyrl ), |
| 33 | + 'kk-latn' => new ReplacementArray( $kk2Latn ), |
| 34 | + 'kk-arab' => new ReplacementArray( $kk2Arab ), |
| 35 | + 'kk-kz' => new ReplacementArray( array_merge($kk2Cyrl, $kk2KZ) ), |
| 36 | + 'kk-tr' => new ReplacementArray( array_merge($kk2Latn, $kk2TR) ), |
| 37 | + 'kk-cn' => new ReplacementArray( array_merge($kk2Arab, $kk2CN) ), |
| 38 | + 'kk' => new ReplacementArray() |
| 39 | + ); |
27 | 40 | |
28 | | - 'şçʹ'=> 'щь', 'bʹ' => 'бь', 'dʹ' => 'дь', 'fʹ' => 'фь', 'gʹ' => 'гь', 'kʹ' => 'кь', 'lʹ' => 'ль', |
29 | | - 'mʹ' => 'мь', 'nʹ' => 'нь', 'pʹ' => 'пь', 'rʹ' => 'рь', 'sʹ' => 'сь', 'tʹ' => 'ть', |
30 | | - 'vʹ' => 'вь', 'zʹ' => 'зь', 'jʹ' => 'жь', 'cʹ' => 'ць', 'çʹ' => 'чь', 'şʹ' => 'шь', |
| 41 | + self::loadRegs(); |
| 42 | + } |
31 | 43 | |
32 | | - 'Bʹ' => 'БЬ', 'Dʹ' => 'ДЬ', 'Fʹ' => 'ФЬ', 'Gʹ' => 'ГЬ', 'Kʹ' => 'КЬ', 'Lʹ' => 'ЛЬ', |
33 | | - 'Mʹ' => 'МЬ', 'Nʹ' => 'НЬ', 'Pʹ' => 'ПЬ', 'Rʹ' => 'РЬ', 'Sʹ' => 'СЬ', 'Tʹ' => 'ТЬ', |
34 | | - 'Vʹ' => 'ВЬ', 'Zʹ' => 'ЗЬ', 'Jʹ' => 'ЖЬ', 'Cʹ' => 'ЦЬ', 'Çʹ' => 'ЧЬ', 'Şʹ' => 'ШЬ', |
| 44 | + function postLoadTables() { |
| 45 | + $this->mTables['kk-kz']->merge( $this->mTables['kk-cyrl'] ); |
| 46 | + $this->mTables['kk-tr']->merge( $this->mTables['kk-latn'] ); |
| 47 | + $this->mTables['kk-cn']->merge( $this->mTables['kk-arab'] ); |
| 48 | + } |
35 | 49 | |
36 | | - 'ŞÇ' => 'Щ', 'Şç' => 'Щ', 'şç' => 'щ', |
| 50 | + function loadRegs() { |
37 | 51 | |
38 | | - 'a' => 'а', 'ä' => 'ә', 'b' => 'б', 'c' => 'ц', 'ç' => 'ч', 'd' => 'д', 'e' => 'е', |
39 | | - 'é' => 'э', 'f' => 'ф', 'g' => 'г', 'ğ' => 'ғ', 'h' => 'һ', 'i' => 'і', 'ı' => 'ы', |
40 | | - 'ï' => 'и', 'j' => 'ж', 'k' => 'к', 'l' => 'л', 'm' => 'м', 'n' => 'н', 'ñ' => 'ң', |
41 | | - 'o' => 'о', 'ö' => 'ө', 'p' => 'п', 'q' => 'қ', 'r' => 'р', 's' => 'с', 'ş' => 'ш', |
42 | | - 't' => 'т', 'u' => 'ұ', 'ü' => 'ү', 'v' => 'в', 'w' => 'у', 'x' => 'х', 'ý' => 'й', |
43 | | - 'z' => 'з', |
| 52 | + $this->mCyrl2Latn = array( |
| 53 | + '/№/u' => 'No.', |
| 54 | + ## Е after vowels |
| 55 | + '/([АӘЕЁИОӨҰҮЭЮЯЪЬ])Е/u' => '$1YE', |
| 56 | + '/([АӘЕЁИОӨҰҮЭЮЯЪЬ])е/ui' => '$1ye', |
| 57 | + ## leading ЁЮЯЩ |
| 58 | + '/^Ё(['.KK_C_UC.']|$)/u' => 'YO$1', '/^Ё(['.KK_C_LC.']|$)/u' => 'Yo$1', |
| 59 | + '/^Ю(['.KK_C_UC.']|$)/u' => 'YU$1', '/^Ю(['.KK_C_LC.']|$)/u' => 'Yu$1', |
| 60 | + '/^Я(['.KK_C_UC.']|$)/u' => 'YA$1', '/^Я(['.KK_C_LC.']|$)/u' => 'Ya$1', |
| 61 | + '/^Щ(['.KK_C_UC.']|$)/u' => 'ŞÇ$1', '/^Щ(['.KK_C_LC.']|$)/u' => 'Şç$1', |
| 62 | + ## other ЁЮЯ |
| 63 | + '/Ё/u' => 'YO', '/ё/u' => 'yo', |
| 64 | + '/Ю/u' => 'YU', '/ю/u' => 'yu', |
| 65 | + '/Я/u' => 'YA', '/я/u' => 'ya', |
| 66 | + '/Щ/u' => 'ŞÇ', '/щ/u' => 'şç', |
| 67 | + ## soft and hard signs |
| 68 | + '/[ъЪ]/u' => 'ʺ', '/[ьЬ]/u' => 'ʹ', |
| 69 | + ## other characters |
| 70 | + '/А/u' => 'A', '/а/u' => 'a', '/Ә/u' => 'Ä', '/ә/u' => 'ä', |
| 71 | + '/Б/u' => 'B', '/б/u' => 'b', '/В/u' => 'V', '/в/u' => 'v', |
| 72 | + '/Г/u' => 'G', '/г/u' => 'g', '/Ғ/u' => 'Ğ', '/ғ/u' => 'ğ', |
| 73 | + '/Д/u' => 'D', '/д/u' => 'd', '/Е/u' => 'E', '/е/u' => 'e', |
| 74 | + '/Ж/u' => 'J', '/ж/u' => 'j', '/З/u' => 'Z', '/з/u' => 'z', |
| 75 | + '/И/u' => 'Ï', '/и/u' => 'ï', '/Й/u' => 'Ý', '/й/u' => 'ý', |
| 76 | + '/К/u' => 'K', '/к/u' => 'k', '/Қ/u' => 'Q', '/қ/u' => 'q', |
| 77 | + '/Л/u' => 'L', '/л/u' => 'l', '/М/u' => 'M', '/м/u' => 'm', |
| 78 | + '/Н/u' => 'N', '/н/u' => 'n', '/Ң/u' => 'Ñ', '/ң/u' => 'ñ', |
| 79 | + '/О/u' => 'O', '/о/u' => 'o', '/Ө/u' => 'Ö', '/ө/u' => 'ö', |
| 80 | + '/П/u' => 'P', '/п/u' => 'p', '/Р/u' => 'R', '/р/u' => 'r', |
| 81 | + '/С/u' => 'S', '/с/u' => 's', '/Т/u' => 'T', '/т/u' => 't', |
| 82 | + '/У/u' => 'W', '/у/u' => 'w', '/Ұ/u' => 'U', '/ұ/u' => 'u', |
| 83 | + '/Ү/u' => 'Ü', '/ү/u' => 'ü', '/Ф/u' => 'F', '/ф/u' => 'f', |
| 84 | + '/Х/u' => 'X', '/х/u' => 'x', '/Һ/u' => 'H', '/һ/u' => 'h', |
| 85 | + '/Ц/u' => 'C', '/ц/u' => 'c', '/Ч/u' => 'Ç', '/ч/u' => 'ç', |
| 86 | + '/Ш/u' => 'Ş', '/ш/u' => 'ş', '/Ы/u' => 'I', '/ы/u' => 'ı', |
| 87 | + '/І/u' => 'İ', '/і/u' => 'i', '/Э/u' => 'É', '/э/u' => 'é', |
| 88 | + ); |
44 | 89 | |
45 | | - 'A' => 'А', 'Ä' => 'Ә', 'B' => 'Б', 'C' => 'Ц', 'Ç' => 'Ч', 'D' => 'Д', 'E' => 'Е', |
46 | | - 'É' => 'Э', 'F' => 'Ф', 'G' => 'Г', 'Ğ' => 'Ғ', 'H' => 'Һ', 'İ' => 'І', 'I' => 'Ы', |
47 | | - 'Ï' => 'И', 'J' => 'Ж', 'K' => 'К', 'L' => 'Л', 'M' => 'М', 'N' => 'Н', 'Ñ' => 'Ң', |
48 | | - 'O' => 'О', 'Ö' => 'Ө', 'P' => 'П', 'Q' => 'Қ', 'R' => 'Р', 'S' => 'С', 'Ş' => 'Ш', |
49 | | - 'T' => 'Т', 'U' => 'Ұ', 'Ü' => 'Ү', 'V' => 'В', 'W' => 'У', 'Ý' => 'Й', 'X' => 'Х', |
50 | | - 'Z' => 'З' |
51 | | - ); |
| 90 | + $this->mLatn2Cyrl = array( |
| 91 | + '/No\./u' => '№', |
| 92 | + ## Şç |
| 93 | + '/ŞÇʹ/u'=> 'ЩЬ', '/Şçʹ/u'=> 'Щь', '/Şçʹ/u'=> 'Щь', |
| 94 | + '/Ş[Çç]/u' => 'Щ', '/şç/u' => 'щ', |
| 95 | + ## soft and hard signs |
| 96 | + '/(['.KK_L_UC.'])ʺ(['.KK_L_UC.'])/u' => '$1Ъ$2', |
| 97 | + '/ʺ(['.KK_L_LC.'])/u' => 'ъ$1', |
| 98 | + '/(['.KK_L_UC.'])ʹ(['.KK_L_UC.'])/u' => '$1Ь$2', |
| 99 | + '/ʹ(['.KK_L_LC.'])/u' => 'ь$1', |
| 100 | + '/ʺ/u' => 'ъ', |
| 101 | + '/ʹ/u' => 'ь', |
| 102 | + ## Ye Yo Yu Ya. |
| 103 | + '/Y[Ee]/u' => 'Е', '/ye/u' => 'е', |
| 104 | + '/Y[Oo]/u' => 'Ё', '/yo/u' => 'ё', |
| 105 | + '/Y[UWuw]/u' => 'Ю', '/y[uw]/u' => 'ю', |
| 106 | + '/Y[Aa]/u' => 'Я', '/ya/u' => 'я', |
| 107 | + ## other characters |
| 108 | + '/A/u' => 'А', '/a/u' => 'а', '/Ä/u' => 'Ә', '/ä/u' => 'ә', |
| 109 | + '/B/u' => 'Б', '/b/u' => 'б', '/C/u' => 'Ц', '/c/u' => 'ц', |
| 110 | + '/Ç/u' => 'Ч', '/ç/u' => 'ч', '/D/u' => 'Д', '/d/u' => 'д', |
| 111 | + '/E/u' => 'Е', '/e/u' => 'е', '/É/u' => 'Э', '/é/u' => 'э', |
| 112 | + '/F/u' => 'Ф', '/f/u' => 'ф', '/G/u' => 'Г', '/g/u' => 'г', |
| 113 | + '/Ğ/u' => 'Ғ', '/ğ/u' => 'ғ', '/H/u' => 'Һ', '/h/u' => 'һ', |
| 114 | + '/I/u' => 'Ы', '/ı/u' => 'ы', '/İ/u' => 'І', '/i/u' => 'і', |
| 115 | + '/Ï/u' => 'И', '/ï/u' => 'и', '/J/u' => 'Ж', '/j/u' => 'ж', |
| 116 | + '/K/u' => 'К', '/k/u' => 'к', '/L/u' => 'Л', '/l/u' => 'л', |
| 117 | + '/M/u' => 'М', '/m/u' => 'м', '/N/u' => 'Н', '/n/u' => 'н', |
| 118 | + '/Ñ/u' => 'Ң', '/ñ/u' => 'ң', '/O/u' => 'О', '/o/u' => 'о', |
| 119 | + '/Ö/u' => 'Ө', '/ö/u' => 'ө', '/P/u' => 'П', '/p/u' => 'п', |
| 120 | + '/Q/u' => 'Қ', '/q/u' => 'қ', '/R/u' => 'Р', '/r/u' => 'р', |
| 121 | + '/S/u' => 'С', '/s/u' => 'с', '/Ş/u' => 'Ш', '/ş/u' => 'ш', |
| 122 | + '/T/u' => 'Т', '/t/u' => 'т', '/U/u' => 'Ұ', '/u/u' => 'ұ', |
| 123 | + '/Ü/u' => 'Ү', '/ü/u' => 'ү', '/V/u' => 'В', '/v/u' => 'в', |
| 124 | + '/W/u' => 'У', '/w/u' => 'у', '/Ý/u' => 'Й', '/ý/u' => 'й', |
| 125 | + '/X/u' => 'Х', '/x/u' => 'х', '/Z/u' => 'З', '/z/u' => 'з', |
| 126 | + ); |
52 | 127 | |
53 | | - var $mCyrillicToLatin = array( |
54 | | - 'а' => 'a', 'ә' => 'ä', 'б' => 'b', 'в' => 'v', 'г' => 'g', 'ғ' => 'ğ', |
55 | | - 'д' => 'd', 'е' => 'e', 'ё' => 'yo', 'ж' => 'j', 'з' => 'z', 'и' => 'ï', |
56 | | - 'й' => 'ý', 'к' => 'k', 'қ' => 'q', 'л' => 'l', 'м' => 'm', 'н' => 'n', |
57 | | - 'ң' => 'ñ', 'о' => 'o', 'ө' => 'ö', 'п' => 'p', 'р' => 'r', 'с' => 's', |
58 | | - 'т' => 't', 'у' => 'w', 'ұ' => 'u', 'ү' => 'ü', 'ф' => 'f', 'х' => 'x', |
59 | | - 'һ' => 'h', 'ц' => 'c', 'ч' => 'ç', 'ш' => 'ş', 'щ' => 'şç', 'ъ' => 'ʺ', |
60 | | - 'ы' => 'ı', 'ь' => 'ʹ', 'і' => 'i', 'э' => 'é', 'ю' => 'yw', 'я' => 'ya', |
| 128 | + $this->mCyLa2Arab = array( |
| 129 | + ## Cyrillic -> Arabic |
| 130 | + '/\№/u' => 'نٶ.', |
| 131 | + '/([АӘЕЁИОӨҰҮЭЮЯЪЬ])е/ui' => '$1يە', |
| 132 | + '/а/ui' => 'ا', '/ә/ui' => 'ٵ', '/б/ui' => 'ب', '/в/ui' => 'ۆ', |
| 133 | + '/г/ui' => 'گ', '/ғ/ui' => 'ع', '/д/ui' => 'د', '/[еэ]/ui' => 'ە', |
| 134 | + '/ё/ui' => 'يو', '/ж/ui' => 'ج', '/з/ui' => 'ز', '/и/ui' => 'ي', |
| 135 | + '/й/ui' => 'ي', '/к/ui' => 'ك', '/қ/ui' => 'ق', '/л/ui' => 'ل', |
| 136 | + '/м/ui' => 'م', '/н/ui' => 'ن', '/ң/ui' => 'ڭ', '/о/ui' => 'و', |
| 137 | + '/ө/ui' => 'ٶ', '/п/ui' => 'پ', '/р/ui' => 'ر', '/с/ui' => 'س', |
| 138 | + '/т/ui' => 'ت', '/у/ui' => 'ۋ', '/ұ/ui' => 'ۇ', '/ү/ui' => 'ٷ', |
| 139 | + '/ф/ui' => 'ف', '/х/ui' => 'ح', '/һ/ui' => 'ھ', '/ц/ui' => 'تس', |
| 140 | + '/ч/ui' => 'چ', '/ш/ui' => 'ش', '/щ/ui' => 'شش', '/[ъь]/ui' => '', |
| 141 | + '/ы/ui' => 'ى', '/і/ui' => 'ٸ', '/ю/ui' => 'يۋ', '/я/ui' => 'يا', |
61 | 142 | |
62 | | - 'А' => 'A', 'Ә' => 'Ä', 'Б' => 'B', 'В' => 'V', 'Г' => 'G', 'Ғ' => 'Ğ', |
63 | | - 'Д' => 'D', 'Е' => 'E', 'Ё' => 'Yo', 'Ж' => 'J', 'З' => 'Z', 'И' => 'Ï', |
64 | | - 'Й' => 'Ý', 'К' => 'K', 'Қ' => 'Q', 'Л' => 'L', 'М' => 'M', 'Н' => 'N', |
65 | | - 'Ң' => 'Ñ', 'О' => 'O', 'Ө' => 'Ö', 'П' => 'P', 'Р' => 'R', 'С' => 'S', |
66 | | - 'Т' => 'T', 'У' => 'W', 'Ұ' => 'U', 'Ү' => 'Ü', 'Ф' => 'F', 'Х' => 'X', |
67 | | - 'Һ' => 'H', 'Ц' => 'C', 'Ч' => 'Ç', 'Ш' => 'Ş', 'Щ' => 'Şç', 'Ъ' => 'ʺ', |
68 | | - 'Ы' => 'I', 'Ь' => 'ʹ', 'І' => 'İ', 'Э' => 'É', 'Ю' => 'Yw', 'Я' => 'Ya' |
69 | | - ); |
| 143 | + ## Latin -> Arabic // commented for now... |
| 144 | + /*'/No\./u' => 'نٶ.', |
| 145 | + '/a/ui' => 'ا', '/ä/ui' => 'ٵ', '/b/ui' => 'ب', '/c/ui' => 'تس', |
| 146 | + '/ç/ui' => 'چ', '/d/ui' => 'د', '/[eé]/ui' => 'ە', '/f/ui' => 'ف', |
| 147 | + '/g/ui' => 'گ', '/ğ/ui' => 'ع', '/h/ui' => 'ھ', '/[ıI]/u' => 'ى', |
| 148 | + '/[iİ]/u' => 'ٸ', '/ï/ui' => 'ي', '/j/ui' => 'ج', '/k/ui' => 'ك', |
| 149 | + '/l/ui' => 'ل', '/m/ui' => 'م', '/n/ui' => 'ن', '/ñ/ui' => 'ڭ', |
| 150 | + '/o/ui' => 'و', '/ö/ui' => 'ٶ', '/p/ui' => 'پ', '/q/ui' => 'ق', |
| 151 | + '/r/ui' => 'ر', '/s/ui' => 'س', '/ş/ui' => 'ش', '/t/ui' => 'ت', |
| 152 | + '/u/ui' => 'ۇ', '/ü/ui' => 'ٷ', '/v/ui' => 'ۆ', '/w/ui' => 'ۋ', |
| 153 | + '/x/ui' => 'ح', '/[yý]/ui' => 'ي', '/z/ui' => 'ز', '/[ʺʹ]/ui' => '',*/ |
70 | 154 | |
71 | | - var $mCyrillicToArabic = array( |
72 | | - 'ла' => 'لا', 'лА' => 'لا', 'ЛА' => 'لا', 'Ла' => 'لا', |
73 | | - |
74 | | - 'а' => 'ا', 'ә' => 'ٵ', 'б' => 'ب', 'в' => 'ۆ', 'г' => 'گ', 'ғ' => 'ع', |
75 | | - 'д' => 'د', 'е' => 'ە', 'ё' => 'يو', 'ж' => 'ج', 'з' => 'ز', 'и' => 'ي', |
76 | | - 'й' => 'ي', 'к' => 'ك', 'қ' => 'ق', 'л' => 'ل', 'м' => 'م', 'н' => 'ن', |
77 | | - 'ң' => 'ڭ', 'о' => 'و', 'ө' => 'ٶ', 'п' => 'پ', 'р' => 'ر', 'с' => 'س', |
78 | | - 'т' => 'ت', 'у' => 'ۋ', 'ұ' => 'ۇ', 'ү' => 'ٷ', 'ф' => 'ف', 'х' => 'ح', |
79 | | - 'һ' => 'ھ', 'ц' => 'تس', 'ч' => 'چ', 'ш' => 'ش', 'щ' => 'شش', 'ъ' => 'ي', |
80 | | - 'ы' => 'ى', 'ь' => 'ي', 'і' => 'ٸ', 'э' => 'ە', 'ю' => 'يۋ', 'я' => 'يا', |
81 | | - |
82 | | - 'А' => 'ا', 'Ә' => 'ٵ', 'Б' => 'ب', 'В' => 'ۆ', 'Г' => 'گ', 'Ғ' => 'ع', |
83 | | - 'Д' => 'د', 'Е' => 'ە', 'Ё' => 'يو', 'Ж' => 'ج', 'З' => 'ز', 'И' => 'ي', |
84 | | - 'Й' => 'ي', 'К' => 'ك', 'Қ' => 'ق', 'Л' => 'ل', 'М' => 'م', 'Н' => 'ن', |
85 | | - 'Ң' => 'ڭ', 'О' => 'و', 'Ө' => 'ٶ', 'П' => 'پ', 'Р' => 'ر', 'С' => 'س', |
86 | | - 'Т' => 'ت', 'У' => 'ۋ', 'Ұ' => 'ۇ', 'Ү' => 'ٷ', 'Ф' => 'ف', 'Х' => 'ح', |
87 | | - 'Һ' => 'ھ', 'Ц' => 'تس', 'Ч' => 'چ', 'Ш' => 'ش', 'Щ' => 'شش', 'Ъ' => 'ي', |
88 | | - 'Ы' => 'ى', 'Ь' => 'ي', 'І' => 'ٸ', 'Э' => 'ە', 'Ю' => 'يۋ', 'Я' => 'يا', |
89 | | - |
90 | | - '?' => '؟', |
91 | | - '%' => '٪', |
92 | | - ',' => '،', |
93 | | - ';' => '؛' |
94 | | - ); |
95 | | - |
96 | | - var $mLatinToArabic = array( |
97 | | - 'la' => 'لا', 'lA' => 'لا', 'LA' => 'لا', 'La' => 'لا', |
98 | | - |
99 | | - 'a' => 'ا', 'ä' => 'ٵ', 'b' => 'ب', 'v' => 'ۆ', 'g' => 'گ', 'ğ' => 'ع', |
100 | | - 'd' => 'د', 'e' => 'ە', 'yo' => 'يو', 'j' => 'ج', 'z' => 'ز', 'ï' => 'ي', |
101 | | - 'ý' => 'ي', 'k' => 'ك', 'q' => 'ق', 'l' => 'ل', 'm' => 'م', 'n' => 'ن', |
102 | | - 'ñ' => 'ڭ', 'o' => 'و', 'ö' => 'ٶ', 'p' => 'پ', 'r' => 'ر', 's' => 'س', |
103 | | - 't' => 'ت', 'w' => 'ۋ', 'u' => 'ۇ', 'ü' => 'ٷ', 'f' => 'ف', 'x' => 'ح', |
104 | | - 'h' => 'ھ', 'c' => 'تس', 'ç' => 'چ', 'ş' => 'ش', 'şş' => 'شش', '″' => 'ي', |
105 | | - 'ı' => 'ى', '′' => 'ي', 'i' => 'ٸ', 'é' => 'ە', |
106 | | - |
107 | | - 'A' => 'ا', 'Ä' => 'ٵ', 'B' => 'ب', 'V' => 'ۆ', 'G' => 'گ', 'Ğ' => 'ع', |
108 | | - 'D' => 'د', 'E' => 'ە', 'YO' => 'يو', 'J' => 'ج', 'Z' => 'ز', 'Ï' => 'ي', |
109 | | - 'Ý' => 'ي', 'K' => 'ك', 'Q' => 'ق', 'L' => 'ل', 'M' => 'م', 'N' => 'ن', |
110 | | - 'Ñ' => 'ڭ', 'O' => 'و', 'Ö' => 'ٶ', 'P' => 'پ', 'R' => 'ر', 'S' => 'س', |
111 | | - 'T' => 'ت', 'W' => 'ۋ', 'U' => 'ۇ', 'Ü' => 'ٷ', 'F' => 'ف', 'X' => 'ح', |
112 | | - 'H' => 'ھ', 'C' => 'تس', 'Ç' => 'چ', 'Ş' => 'ش', 'ŞŞ' => 'شش', '″' => 'ي', |
113 | | - 'I' => 'ى', '′' => 'ي', 'İ' => 'ٸ', 'É' => 'ە', |
114 | | - |
115 | | - '?' => '؟', |
116 | | - '%' => '٪', |
117 | | - ',' => '،', |
118 | | - ';' => '؛' |
119 | | - ); |
120 | | - |
121 | | - function loadDefaultTables() { |
122 | | - $this->mTables = array( |
123 | | - 'kk-cyrl' => new ReplacementArray( $this->mLatinToCyrillic ), |
124 | | - 'kk-latn' => new ReplacementArray( $this->mCyrillicToLatin ), |
125 | | - 'kk-arab' => new ReplacementArray( array_merge($this->mCyrillicToArabic, $this->mLatinToArabic) ), |
126 | | - 'kk-kz' => new ReplacementArray( $this->mLatinToCyrillic ), |
127 | | - 'kk-tr' => new ReplacementArray( $this->mCyrillicToLatin ), |
128 | | - 'kk-cn' => new ReplacementArray( array_merge($this->mCyrillicToArabic, $this->mLatinToArabic) ), |
129 | | - 'kk' => new ReplacementArray() |
| 155 | + ## Punctuation -> Arabic |
| 156 | + '/\?/' => '؟', # ؟ |
| 157 | + '/\,/' => '،', # ، |
| 158 | + '/\;/' => '؛' , # ؛ |
| 159 | + '/\%/' => '٪', # ٪ |
| 160 | + ## Digits -> Arabic |
| 161 | + '/0/' => '۰', # ۰ |
| 162 | + '/1/' => '۱', # ۱ |
| 163 | + '/2/' => '۲', # ۲ |
| 164 | + '/3/' => '۳', # ۳ |
| 165 | + '/4/' => '۴', # ۴ |
| 166 | + '/5/' => '۵', # ۵ |
| 167 | + '/6/' => '۶', # ۶ |
| 168 | + '/7/' => '۷', # ۷ |
| 169 | + '/8/' => '۸', # ۸ |
| 170 | + '/9/' => '۹', # ۹ |
130 | 171 | ); |
131 | | - } |
132 | 172 | |
133 | | - function postLoadTables() { |
134 | | - $this->mTables['kk-kz']->merge( $this->mTables['kk-cyrl'] ); |
135 | | - $this->mTables['kk-tr']->merge( $this->mTables['kk-latn'] ); |
136 | | - $this->mTables['kk-cn']->merge( $this->mTables['kk-arab'] ); |
137 | 173 | } |
138 | 174 | |
139 | 175 | /* rules should be defined as -{ekavian | iyekavian-} -or- |
140 | 176 | -{code:text | code:text | ...}- |
141 | 177 | update: delete all rule parsing because it's not used |
142 | | - currently, and just produces a couple of bugs |
| 178 | + currently, and just produces a couple of bugs |
143 | 179 | */ |
144 | 180 | function parseManualRule($rule, $flags=array()) { |
145 | 181 | if(in_array('T',$flags)){ |
— | — | @@ -165,9 +201,9 @@ |
166 | 202 | |
167 | 203 | /* |
168 | 204 | * A function wrapper: |
169 | | - * - if there is no selected variant, leave the link |
170 | | - * names as they were |
171 | | - * - do not try to find variants for usernames |
| 205 | + * - if there is no selected variant, leave the link |
| 206 | + * names as they were |
| 207 | + * - do not try to find variants for usernames |
172 | 208 | */ |
173 | 209 | function findVariantLink( &$link, &$nt ) { |
174 | 210 | // check for user namespace |
— | — | @@ -184,16 +220,6 @@ |
185 | 221 | } |
186 | 222 | |
187 | 223 | /* |
188 | | - * We want our external link captions to be converted in variants, |
189 | | - * so we return the original text instead -{$text}-, except for URLs |
190 | | - */ |
191 | | - function markNoConversion($text, $noParse=false) { |
192 | | - if($noParse || preg_match("/^https?:\/\/|ftp:\/\/|irc:\/\//",$text)) |
193 | | - return parent::markNoConversion($text); |
194 | | - return $text; |
195 | | - } |
196 | | - |
197 | | - /* |
198 | 224 | * An ugly function wrapper for parsing Image titles |
199 | 225 | * (to prevent image name conversion) |
200 | 226 | */ |
— | — | @@ -207,38 +233,97 @@ |
208 | 234 | } |
209 | 235 | |
210 | 236 | /** |
211 | | - * It translates text into variant, specials: |
212 | | - * - ommiting roman numbers |
| 237 | + * It translates text into variant |
213 | 238 | */ |
214 | | - function translate($text, $toVariant){ |
215 | | - $breaks = '[^\w\x80-\xff]'; |
| 239 | + function translate( $text, $toVariant ){ |
| 240 | + global $wgContLanguageCode; |
| 241 | + $text = parent::translate( $text, $toVariant ); |
216 | 242 | |
217 | | - // regexp for roman numbers |
218 | | - $roman = 'M{0,4}(CM|CD|D?C{0,3})(XC|XL|L?X{0,3})(IX|IV|V?I{0,3})'; |
| 243 | + $letters = ''; |
| 244 | + switch( $toVariant ) { |
| 245 | + case 'kk-cyrl': |
| 246 | + case 'kk-kz': |
| 247 | + $letters = KK_L_UC . KK_L_LC . 'ʺʹ0123456789'; |
| 248 | + $wgContLanguageCode = 'kk'; |
| 249 | + break; |
| 250 | + case 'kk-latn': |
| 251 | + case 'kk-tr': |
| 252 | + $letters = KK_C_UC . KK_C_LC . '№0123456789'; |
| 253 | + $wgContLanguageCode = 'kk-Latn'; |
| 254 | + break; |
| 255 | + case 'kk-arab': |
| 256 | + case 'kk-cn': |
| 257 | + // $letters = KK_C_UC.KK_C_LC.KK_L_UC.KK_L_LC.'ʺʹ%№0123456789?,;'; |
| 258 | + $letters = KK_C_UC . KK_C_LC . '%№0123456789?,;'; |
| 259 | + $wgContLanguageCode = 'kk-Arab'; |
| 260 | + break; |
| 261 | + default: |
| 262 | + $wgContLanguageCode = 'kk'; |
| 263 | + return $text; |
| 264 | + } |
| 265 | + // disable conversion variables like $1, $2... |
| 266 | + $varsfix = '\$[0-9]'; |
219 | 267 | |
220 | | - $reg = '/^'.$roman.'$|^'.$roman.$breaks.'|'.$breaks.$roman.'$|'.$breaks.$roman.$breaks.'/'; |
| 268 | + $matches = preg_split( '/' . $varsfix . '[^' . $letters . ']+/u', $text, -1, PREG_SPLIT_OFFSET_CAPTURE); |
| 269 | + $mstart = 0; |
| 270 | + foreach( $matches as $m ) { |
| 271 | + $ret .= substr( $text, $mstart, $m[1]-$mstart ); |
| 272 | + $ret .= $this->regsConverter( $m[0], $toVariant ); |
| 273 | + $mstart = $m[1] + strlen($m[0]); |
| 274 | + } |
| 275 | + return $ret; |
| 276 | + } |
221 | 277 | |
222 | | - $matches = preg_split($reg, $text, -1, PREG_SPLIT_OFFSET_CAPTURE); |
| 278 | + function regsConverter( $text, $toVariant ) { |
| 279 | + if ($text == '') return $text; |
223 | 280 | |
224 | | - $m = array_shift($matches); |
225 | | - if( !isset( $this->mTables[$toVariant] ) ) { |
226 | | - throw new MWException( "Broken variant table: " . implode( ',', array_keys( $this->mTables ) ) ); |
| 281 | + $pat = array(); |
| 282 | + $rep = array(); |
| 283 | + switch( $toVariant ) { |
| 284 | + case 'kk-arab': |
| 285 | + case 'kk-cn': |
| 286 | + foreach( $this->mCyLa2Arab as $pat => $rep ) { |
| 287 | + $text = preg_replace( $pat, $rep, $text ); |
| 288 | + } |
| 289 | + return $text; |
| 290 | + break; |
| 291 | + case 'kk-latn': |
| 292 | + case 'kk-tr': |
| 293 | + foreach( $this->mCyrl2Latn as $pat => $rep ) { |
| 294 | + $text = preg_replace( $pat, $rep, $text ); |
| 295 | + } |
| 296 | + return $text; |
| 297 | + break; |
| 298 | + case 'kk-cyrl': |
| 299 | + case 'kk-cn': |
| 300 | + foreach( $this->mLatn2Cyrl as $pat => $rep ) { |
| 301 | + $text = preg_replace( $pat, $rep, $text ); |
| 302 | + } |
| 303 | + return $text; |
| 304 | + break; |
| 305 | + default: |
| 306 | + return $text; |
227 | 307 | } |
228 | | - $ret = $this->mTables[$toVariant]->replace( $m[0] ); |
229 | | - $mstart = $m[1]+strlen($m[0]); |
230 | | - foreach($matches as $m) { |
231 | | - $ret .= substr($text, $mstart, $m[1]-$mstart); |
232 | | - $ret .= parent::translate($m[0], $toVariant); |
233 | | - $mstart = $m[1] + strlen($m[0]); |
234 | | - } |
| 308 | + } |
235 | 309 | |
236 | | - return $ret; |
| 310 | + /* |
| 311 | + * We want our external link captions to be converted in variants, |
| 312 | + * so we return the original text instead -{$text}-, except for URLs |
| 313 | + */ |
| 314 | + function markNoConversion( $text, $noParse=false ) { |
| 315 | + if( $noParse || preg_match( "/^https?:\/\/|ftp:\/\/|irc:\/\//", $text ) ) |
| 316 | + return parent::markNoConversion( $text ); |
| 317 | + return $text; |
237 | 318 | } |
238 | 319 | |
| 320 | + function convertCategoryKey( $key ) { |
| 321 | + return $this->autoConvert( $key, 'kk' ); |
| 322 | + } |
| 323 | + |
239 | 324 | } |
240 | 325 | |
241 | 326 | /* class that handles Cyrillic, Latin and Arabic scripts for Kazakh |
242 | | - right now it only distinguish kk_cyrl, kk_latn, kk_arab, kk_kz, kk_tr and kk_cn. |
| 327 | + right now it only distinguish kk_cyrl, kk_latn, kk_arab and kk_kz, kk_tr, kk_cn. |
243 | 328 | */ |
244 | 329 | class LanguageKk extends LanguageKk_cyrl { |
245 | 330 | |
— | — | @@ -262,38 +347,27 @@ |
263 | 348 | $wgHooks['ArticleSaveComplete'][] = $this->mConverter; |
264 | 349 | } |
265 | 350 | |
266 | | - function convertGrammar( $word, $case ) { |
267 | | - $fname="LanguageKk::convertGrammar"; |
268 | | - wfProfileIn( $fname ); |
269 | | - |
270 | | - switch ( $this->getPreferredVariant() ) { |
271 | | - case 'kk-cn': |
272 | | - case 'kk-arab': |
273 | | - $word = parent::convertGrammar( $word, $case, $variant='kk-arab' ); |
274 | | - break; |
275 | | - case 'kk-tr': |
276 | | - case 'kk-latn': |
277 | | - $word = parent::convertGrammar( $word, $case, $variant='kk-latn' ); |
278 | | - break; |
279 | | - case 'kk-kz': |
280 | | - case 'kk-cyrl': |
281 | | - case 'kk': |
282 | | - $word = parent::convertGrammar( $word, $case, $variant='kk-cyrl' ); |
283 | | - break; |
284 | | - default: |
285 | | - $word = parent::convertGrammar( $word, $case, $variant='kk-cyrl' ); |
| 351 | + /** |
| 352 | + * Work around for right-to-left direction support in kk-arab and kk-cn |
| 353 | + * |
| 354 | + * @return bool |
| 355 | + */ |
| 356 | + function isRTL() { |
| 357 | + $variant = $this->getPreferredVariant(); |
| 358 | + if ( $variant == 'kk-arab' || $variant == 'kk-cn' ) { |
| 359 | + return true; |
| 360 | + } else { |
| 361 | + return parent::isRTL(); |
286 | 362 | } |
287 | | - |
288 | | - wfProfileOut( $fname ); |
289 | | - return $word; |
290 | 363 | } |
291 | 364 | |
292 | 365 | /* |
293 | | - * It fixes issue ucfirst with transforming 'i' to 'İ' |
| 366 | + * It fixes issue with ucfirst for transforming 'i' to 'İ' |
294 | 367 | * |
295 | 368 | */ |
296 | 369 | function ucfirst ( $string ) { |
297 | | - if ( ($this->getPreferredVariant() == 'kk-tr' || $this->getPreferredVariant() == 'kk-latn') && $string[0] == 'i' ) { |
| 370 | + $variant = $this->getPreferredVariant(); |
| 371 | + if ( ($variant == 'kk-latn' || $variant == 'kk-tr') && $string[0] == 'i' ) { |
298 | 372 | $string = 'İ' . substr( $string, 1 ); |
299 | 373 | } else { |
300 | 374 | $string = parent::ucfirst( $string ); |
— | — | @@ -302,11 +376,12 @@ |
303 | 377 | } |
304 | 378 | |
305 | 379 | /* |
306 | | - * It fixes issue for lcfirst with transforming 'I' to 'ı' |
| 380 | + * It fixes issue with lcfirst for transforming 'I' to 'ı' |
307 | 381 | * |
308 | 382 | */ |
309 | 383 | function lcfirst ( $string ) { |
310 | | - if ( ($this->getPreferredVariant() == 'kk-tr' || $this->getPreferredVariant() == 'kk-latn') && $string[0] == 'I' ) { |
| 384 | + $variant = $this->getPreferredVariant(); |
| 385 | + if ( ($variant == 'kk-latn' || $variant == 'kk-tr') && $string[0] == 'I' ) { |
311 | 386 | $string = 'ı' . substr( $string, 1 ); |
312 | 387 | } else { |
313 | 388 | $string = parent::lcfirst( $string ); |
— | — | @@ -314,6 +389,29 @@ |
315 | 390 | return $string; |
316 | 391 | } |
317 | 392 | |
318 | | -} |
| 393 | + function convertGrammar( $word, $case ) { |
| 394 | + $fname="LanguageKk::convertGrammar"; |
| 395 | + wfProfileIn( $fname ); |
319 | 396 | |
| 397 | + $variant = $this->getPreferredVariant(); |
| 398 | + switch ( $variant ) { |
| 399 | + case 'kk-arab': |
| 400 | + case 'kk-cn': |
| 401 | + $word = parent::convertGrammar( $word, $case, $variant = 'kk-arab' ); |
| 402 | + break; |
| 403 | + case 'kk-latn': |
| 404 | + case 'kk-tr': |
| 405 | + $word = parent::convertGrammar( $word, $case, $variant = 'kk-latn' ); |
| 406 | + break; |
| 407 | + case 'kk-cyrl': |
| 408 | + case 'kk-kz': |
| 409 | + case 'kk': |
| 410 | + default: |
| 411 | + $word = parent::convertGrammar( $word, $case, $variant = 'kk-cyrl' ); |
| 412 | + } |
320 | 413 | |
| 414 | + wfProfileOut( $fname ); |
| 415 | + return $word; |
| 416 | + } |
| 417 | + |
| 418 | +} |