LanguageKk.php 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459
  1. <?php
  2. require_once( dirname(__FILE__).'/../LanguageConverter.php' );
  3. require_once( dirname(__FILE__).'/LanguageKk_cyrl.php' );
  4. define( 'KK_C_UC', 'АӘБВГҒДЕЁЖЗИЙКҚЛМНҢОӨПРСТУҰҮФХҺЦЧШЩЪЫІЬЭЮЯ' ); # Kazakh Cyrillic uppercase
  5. define( 'KK_C_LC', 'аәбвгғдеёжзийкқлмнңоөпрстуұүфхһцчшщъыіьэюя' ); # Kazakh Cyrillic lowercase
  6. define( 'KK_L_UC', 'AÄBCÇDEÉFGĞHIİÏJKLMNÑOÖPQRSŞTUÜVWXYÝZ' ); # Kazakh Latin uppercase
  7. define( 'KK_L_LC', 'aäbcçdeéfgğhıiïjklmnñoöpqrsştuüvwxyýz' ); # Kazakh Latin lowercase
  8. //define( 'KK_A', 'ٴابپتجحدرزسشعفقكلمنڭەوۇۋۆىيچھ' ); # Kazakh Arabic
  9. define( 'H_HAMZA', 'ٴ' ); # U+0674 ARABIC LETTER HIGH HAMZA
  10. //define( 'ZWNJ', '‌' ); # U+200C ZERO WIDTH NON-JOINER
  11. /** Kazakh (Қазақша)
  12. * converter routines
  13. *
  14. * @ingroup Language
  15. */
  16. class KkConverter extends LanguageConverter {
  17. function __construct($langobj, $maincode,
  18. $variants=array(),
  19. $variantfallbacks=array(),
  20. $markup=array(),
  21. $flags = array()) {
  22. parent::__construct( $langobj, $maincode,
  23. $variants, $variantfallbacks, $markup, $flags );
  24. // No point delaying this since they're in code.
  25. // Waiting until loadDefaultTables() means they never get loaded
  26. // when the tables themselves are loaded from cache.
  27. $this->loadRegs();
  28. }
  29. function loadDefaultTables() {
  30. // require( dirname(__FILE__)."/../../includes/KkConversion.php" );
  31. // Placeholder for future implementing. Remove variables declarations
  32. // after generating KkConversion.php
  33. $kk2Cyrl = array();
  34. $kk2Latn = array();
  35. $kk2Arab = array();
  36. $kk2KZ = array();
  37. $kk2TR = array();
  38. $kk2CN = array();
  39. $this->mTables = array(
  40. 'kk-cyrl' => new ReplacementArray( $kk2Cyrl ),
  41. 'kk-latn' => new ReplacementArray( $kk2Latn ),
  42. 'kk-arab' => new ReplacementArray( $kk2Arab ),
  43. 'kk-kz' => new ReplacementArray( array_merge($kk2Cyrl, $kk2KZ) ),
  44. 'kk-tr' => new ReplacementArray( array_merge($kk2Latn, $kk2TR) ),
  45. 'kk-cn' => new ReplacementArray( array_merge($kk2Arab, $kk2CN) ),
  46. 'kk' => new ReplacementArray()
  47. );
  48. }
  49. function postLoadTables() {
  50. $this->mTables['kk-kz']->merge( $this->mTables['kk-cyrl'] );
  51. $this->mTables['kk-tr']->merge( $this->mTables['kk-latn'] );
  52. $this->mTables['kk-cn']->merge( $this->mTables['kk-arab'] );
  53. }
  54. function loadRegs() {
  55. $this->mCyrl2Latn = array(
  56. ## Punctuation
  57. '/№/u' => 'No.',
  58. ## Е after vowels
  59. '/([АӘЕЁИОӨҰҮЭЮЯЪЬ])Е/u' => '$1YE',
  60. '/([АӘЕЁИОӨҰҮЭЮЯЪЬ])е/ui' => '$1ye',
  61. ## leading ЁЮЯЩ
  62. '/^Ё(['.KK_C_UC.']|$)/u' => 'YO$1', '/^Ё(['.KK_C_LC.']|$)/u' => 'Yo$1',
  63. '/^Ю(['.KK_C_UC.']|$)/u' => 'YU$1', '/^Ю(['.KK_C_LC.']|$)/u' => 'Yu$1',
  64. '/^Я(['.KK_C_UC.']|$)/u' => 'YA$1', '/^Я(['.KK_C_LC.']|$)/u' => 'Ya$1',
  65. '/^Щ(['.KK_C_UC.']|$)/u' => 'ŞÇ$1', '/^Щ(['.KK_C_LC.']|$)/u' => 'Şç$1',
  66. ## other ЁЮЯ
  67. '/Ё/u' => 'YO', '/ё/u' => 'yo',
  68. '/Ю/u' => 'YU', '/ю/u' => 'yu',
  69. '/Я/u' => 'YA', '/я/u' => 'ya',
  70. '/Щ/u' => 'ŞÇ', '/щ/u' => 'şç',
  71. ## soft and hard signs
  72. '/[ъЪ]/u' => 'ʺ', '/[ьЬ]/u' => 'ʹ',
  73. ## other characters
  74. '/А/u' => 'A', '/а/u' => 'a', '/Ә/u' => 'Ä', '/ә/u' => 'ä',
  75. '/Б/u' => 'B', '/б/u' => 'b', '/В/u' => 'V', '/в/u' => 'v',
  76. '/Г/u' => 'G', '/г/u' => 'g', '/Ғ/u' => 'Ğ', '/ғ/u' => 'ğ',
  77. '/Д/u' => 'D', '/д/u' => 'd', '/Е/u' => 'E', '/е/u' => 'e',
  78. '/Ж/u' => 'J', '/ж/u' => 'j', '/З/u' => 'Z', '/з/u' => 'z',
  79. '/И/u' => 'Ï', '/и/u' => 'ï', '/Й/u' => 'Ý', '/й/u' => 'ý',
  80. '/К/u' => 'K', '/к/u' => 'k', '/Қ/u' => 'Q', '/қ/u' => 'q',
  81. '/Л/u' => 'L', '/л/u' => 'l', '/М/u' => 'M', '/м/u' => 'm',
  82. '/Н/u' => 'N', '/н/u' => 'n', '/Ң/u' => 'Ñ', '/ң/u' => 'ñ',
  83. '/О/u' => 'O', '/о/u' => 'o', '/Ө/u' => 'Ö', '/ө/u' => 'ö',
  84. '/П/u' => 'P', '/п/u' => 'p', '/Р/u' => 'R', '/р/u' => 'r',
  85. '/С/u' => 'S', '/с/u' => 's', '/Т/u' => 'T', '/т/u' => 't',
  86. '/У/u' => 'W', '/у/u' => 'w', '/Ұ/u' => 'U', '/ұ/u' => 'u',
  87. '/Ү/u' => 'Ü', '/ү/u' => 'ü', '/Ф/u' => 'F', '/ф/u' => 'f',
  88. '/Х/u' => 'X', '/х/u' => 'x', '/Һ/u' => 'H', '/һ/u' => 'h',
  89. '/Ц/u' => 'C', '/ц/u' => 'c', '/Ч/u' => 'Ç', '/ч/u' => 'ç',
  90. '/Ш/u' => 'Ş', '/ш/u' => 'ş', '/Ы/u' => 'I', '/ы/u' => 'ı',
  91. '/І/u' => 'İ', '/і/u' => 'i', '/Э/u' => 'É', '/э/u' => 'é',
  92. );
  93. $this->mLatn2Cyrl = array(
  94. ## Punctuation
  95. '/#|No\./' => '№',
  96. ## Şç
  97. '/ŞÇʹ/u'=> 'ЩЬ', '/Şçʹ/u'=> 'Щь', '/Şçʹ/u'=> 'Щь',
  98. '/Ş[Çç]/u' => 'Щ', '/şç/u' => 'щ',
  99. ## soft and hard signs
  100. '/(['.KK_L_UC.'])ʺ(['.KK_L_UC.'])/u' => '$1Ъ$2',
  101. '/ʺ(['.KK_L_LC.'])/u' => 'ъ$1',
  102. '/(['.KK_L_UC.'])ʹ(['.KK_L_UC.'])/u' => '$1Ь$2',
  103. '/ʹ(['.KK_L_LC.'])/u' => 'ь$1',
  104. '/ʺ/u' => 'ъ',
  105. '/ʹ/u' => 'ь',
  106. ## Ye Yo Yu Ya.
  107. '/Y[Ee]/u' => 'Е', '/ye/u' => 'е',
  108. '/Y[Oo]/u' => 'Ё', '/yo/u' => 'ё',
  109. '/Y[UWuw]/u' => 'Ю', '/y[uw]/u' => 'ю',
  110. '/Y[Aa]/u' => 'Я', '/ya/u' => 'я',
  111. ## other characters
  112. '/A/u' => 'А', '/a/u' => 'а', '/Ä/u' => 'Ә', '/ä/u' => 'ә',
  113. '/B/u' => 'Б', '/b/u' => 'б', '/C/u' => 'Ц', '/c/u' => 'ц',
  114. '/Ç/u' => 'Ч', '/ç/u' => 'ч', '/D/u' => 'Д', '/d/u' => 'д',
  115. '/E/u' => 'Е', '/e/u' => 'е', '/É/u' => 'Э', '/é/u' => 'э',
  116. '/F/u' => 'Ф', '/f/u' => 'ф', '/G/u' => 'Г', '/g/u' => 'г',
  117. '/Ğ/u' => 'Ғ', '/ğ/u' => 'ғ', '/H/u' => 'Һ', '/h/u' => 'һ',
  118. '/I/u' => 'Ы', '/ı/u' => 'ы', '/İ/u' => 'І', '/i/u' => 'і',
  119. '/Ï/u' => 'И', '/ï/u' => 'и', '/J/u' => 'Ж', '/j/u' => 'ж',
  120. '/K/u' => 'К', '/k/u' => 'к', '/L/u' => 'Л', '/l/u' => 'л',
  121. '/M/u' => 'М', '/m/u' => 'м', '/N/u' => 'Н', '/n/u' => 'н',
  122. '/Ñ/u' => 'Ң', '/ñ/u' => 'ң', '/O/u' => 'О', '/o/u' => 'о',
  123. '/Ö/u' => 'Ө', '/ö/u' => 'ө', '/P/u' => 'П', '/p/u' => 'п',
  124. '/Q/u' => 'Қ', '/q/u' => 'қ', '/R/u' => 'Р', '/r/u' => 'р',
  125. '/S/u' => 'С', '/s/u' => 'с', '/Ş/u' => 'Ш', '/ş/u' => 'ш',
  126. '/T/u' => 'Т', '/t/u' => 'т', '/U/u' => 'Ұ', '/u/u' => 'ұ',
  127. '/Ü/u' => 'Ү', '/ü/u' => 'ү', '/V/u' => 'В', '/v/u' => 'в',
  128. '/W/u' => 'У', '/w/u' => 'у', '/Ý/u' => 'Й', '/ý/u' => 'й',
  129. '/X/u' => 'Х', '/x/u' => 'х', '/Z/u' => 'З', '/z/u' => 'з',
  130. );
  131. $this->mCyLa2Arab = array(
  132. ## Punctuation -> Arabic
  133. '/#|№|No\./u' => '؀', # &#x0600;
  134. '/\,/' => '،', # &#x060C;
  135. '/;/' => '؛', # &#x061B;
  136. '/\?/' => '؟', # &#x061F;
  137. '/%/' => '٪', # &#x066A;
  138. '/\*/' => '٭', # &#x066D;
  139. ## Digits -> Arabic
  140. '/0/' => '۰', # &#x06F0;
  141. '/1/' => '۱', # &#x06F1;
  142. '/2/' => '۲', # &#x06F2;
  143. '/3/' => '۳', # &#x06F3;
  144. '/4/' => '۴', # &#x06F4;
  145. '/5/' => '۵', # &#x06F5;
  146. '/6/' => '۶', # &#x06F6;
  147. '/7/' => '۷', # &#x06F7;
  148. '/8/' => '۸', # &#x06F8;
  149. '/9/' => '۹', # &#x06F9;
  150. ## Cyrillic -> Arabic
  151. '/Аллаһ/ui' => 'ﷲ',
  152. '/([АӘЕЁИОӨҰҮЭЮЯЪЬ])е/ui' => '$1يە',
  153. '/[еэ]/ui' => 'ە', '/[ъь]/ui' => '',
  154. '/[аә]/ui' => 'ا', '/[оө]/ui' => 'و', '/[ұү]/ui' => 'ۇ', '/[ыі]/ui' => 'ى',
  155. '/[и]/ui' => 'ىي', '/ё/ui' => 'يو', '/ю/ui' => 'يۋ', '/я/ui' => 'يا', '/[й]/ui' => 'ي',
  156. '/ц/ui' => 'تس', '/щ/ui' => 'شش',
  157. '/һ/ui' => 'ح', '/ч/ui' => 'تش',
  158. #'/һ/ui' => 'ھ', '/ч/ui' => 'چ',
  159. '/б/ui' => 'ب', '/в/ui' => 'ۆ', '/г/ui' => 'گ', '/ғ/ui' => 'ع',
  160. '/д/ui' => 'د', '/ж/ui' => 'ج', '/з/ui' => 'ز', '/к/ui' => 'ك',
  161. '/қ/ui' => 'ق', '/л/ui' => 'ل', '/м/ui' => 'م', '/н/ui' => 'ن',
  162. '/ң/ui' => 'ڭ', '/п/ui' => 'پ', '/р/ui' => 'ر', '/с/ui' => 'س',
  163. '/т/ui' => 'ت', '/у/ui' => 'ۋ', '/ф/ui' => 'ف', '/х/ui' => 'ح',
  164. '/ш/ui' => 'ش',
  165. ## Latin -> Arabic // commented for now...
  166. /*'/Allah/ui' => 'ﷲ',
  167. '/[eé]/ui' => 'ە', '/[yý]/ui' => 'ي', '/[ʺʹ]/ui' => '',
  168. '/[aä]/ui' => 'ا', '/[oö]/ui' => 'و', '/[uü]/ui' => 'ۇ',
  169. '/[ï]/ui' => 'ىي', '/[ıIiİ]/u' => 'ى',
  170. '/c/ui' => 'تس',
  171. '/ç/ui' => 'تش', '/h/ui' => 'ح',
  172. #'/ç/ui' => 'چ', '/h/ui' => 'ھ',
  173. '/b/ui' => 'ب','/d/ui' => 'د',
  174. '/f/ui' => 'ف', '/g/ui' => 'گ', '/ğ/ui' => 'ع',
  175. '/j/ui' => 'ج', '/k/ui' => 'ك', '/l/ui' => 'ل', '/m/ui' => 'م',
  176. '/n/ui' => 'ن', '/ñ/ui' => 'ڭ', '/p/ui' => 'پ', '/q/ui' => 'ق',
  177. '/r/ui' => 'ر', '/s/ui' => 'س', '/ş/ui' => 'ش', '/t/ui' => 'ت',
  178. '/v/ui' => 'ۆ', '/w/ui' => 'ۋ', '/x/ui' => 'ح', '/z/ui' => 'ز',*/
  179. );
  180. }
  181. /* rules should be defined as -{ekavian | iyekavian-} -or-
  182. -{code:text | code:text | ...}-
  183. update: delete all rule parsing because it's not used
  184. currently, and just produces a couple of bugs
  185. */
  186. function parseManualRule($rule, $flags=array()) {
  187. if(in_array('T',$flags)){
  188. return parent::parseManualRule($rule, $flags);
  189. }
  190. // otherwise ignore all formatting
  191. foreach($this->mVariants as $v) {
  192. $carray[$v] = $rule;
  193. }
  194. return $carray;
  195. }
  196. // Do not convert content on talk pages
  197. function parserConvert( $text, &$parser ){
  198. if(is_object($parser->getTitle() ) && $parser->getTitle()->isTalkPage())
  199. $this->mDoContentConvert=false;
  200. else
  201. $this->mDoContentConvert=true;
  202. return parent::parserConvert($text, $parser );
  203. }
  204. /*
  205. * A function wrapper:
  206. * - if there is no selected variant, leave the link
  207. * names as they were
  208. * - do not try to find variants for usernames
  209. */
  210. function findVariantLink( &$link, &$nt, $ignoreOtherCond = false ) {
  211. // check for user namespace
  212. if(is_object($nt)){
  213. $ns = $nt->getNamespace();
  214. if($ns==NS_USER || $ns==NS_USER_TALK)
  215. return;
  216. }
  217. $oldlink=$link;
  218. parent::findVariantLink( $link, $nt, $ignoreOtherCond );
  219. if( $this->getPreferredVariant()==$this->mMainLanguageCode )
  220. $link=$oldlink;
  221. }
  222. /*
  223. * An ugly function wrapper for parsing Image titles
  224. * (to prevent image name conversion)
  225. */
  226. function autoConvert($text, $toVariant=false) {
  227. global $wgTitle;
  228. if(is_object($wgTitle) && $wgTitle->getNameSpace()==NS_FILE){
  229. $imagename = $wgTitle->getNsText();
  230. if(preg_match("/^$imagename:/",$text)) return $text;
  231. }
  232. return parent::autoConvert($text,$toVariant);
  233. }
  234. /**
  235. * It translates text into variant
  236. */
  237. function translate( $text, $toVariant ){
  238. global $wgContLanguageCode;
  239. $text = parent::translate( $text, $toVariant );
  240. $letters = '';
  241. switch( $toVariant ) {
  242. case 'kk-cyrl':
  243. case 'kk-kz':
  244. $letters = KK_L_UC . KK_L_LC . 'ʺʹ#0123456789';
  245. $wgContLanguageCode = 'kk';
  246. break;
  247. case 'kk-latn':
  248. case 'kk-tr':
  249. $letters = KK_C_UC . KK_C_LC . '№0123456789';
  250. $wgContLanguageCode = 'kk-Latn';
  251. break;
  252. case 'kk-arab':
  253. case 'kk-cn':
  254. $letters = KK_C_UC.KK_C_LC./*KK_L_UC.KK_L_LC.'ʺʹ'.*/',;\?%\*№0123456789';
  255. $wgContLanguageCode = 'kk-Arab';
  256. break;
  257. default:
  258. $wgContLanguageCode = 'kk';
  259. return $text;
  260. }
  261. // disable conversion variables like $1, $2...
  262. $varsfix = '\$[0-9]';
  263. $matches = preg_split( '/' . $varsfix . '[^' . $letters . ']+/u', $text, -1, PREG_SPLIT_OFFSET_CAPTURE);
  264. $mstart = 0;
  265. $ret = '';
  266. foreach( $matches as $m ) {
  267. $ret .= substr( $text, $mstart, $m[1]-$mstart );
  268. $ret .= $this->regsConverter( $m[0], $toVariant );
  269. $mstart = $m[1] + strlen($m[0]);
  270. }
  271. return $ret;
  272. }
  273. function regsConverter( $text, $toVariant ) {
  274. if ($text == '') return $text;
  275. $pat = array();
  276. $rep = array();
  277. switch( $toVariant ) {
  278. case 'kk-arab':
  279. case 'kk-cn':
  280. $letters = KK_C_LC.KK_C_UC/*.KK_L_LC.KK_L_UC*/;
  281. $front = 'әөүіӘӨҮІ'/*.'äöüiÄÖÜİ'*/;
  282. $excludes = 'еэгғкқЕЭГҒКҚ'/*.'eégğkqEÉGĞKQ'*/;
  283. // split text to words
  284. $matches = preg_split( '/[\b\s\-\.:]+/', $text, -1, PREG_SPLIT_OFFSET_CAPTURE);
  285. $mstart = 0;
  286. $ret = '';
  287. foreach( $matches as $m ) {
  288. $ret .= substr( $text, $mstart, $m[1] - $mstart );
  289. // is matched the word to front vowels?
  290. // exclude a words matched to е, э, г, к, к, қ,
  291. // them should be without hamza
  292. if ( preg_match('/['.$front.']/u', $m[0]) && !preg_match('/['.$excludes.']/u', $m[0]) ) {
  293. $ret .= preg_replace('/['.$letters.']+/u', H_HAMZA.'$0', $m[0]);
  294. } else {
  295. $ret .= $m[0];
  296. }
  297. $mstart = $m[1] + strlen($m[0]);
  298. }
  299. $text =& $ret;
  300. foreach( $this->mCyLa2Arab as $pat => $rep ) {
  301. $text = preg_replace( $pat, $rep, $text );
  302. }
  303. return $text;
  304. break;
  305. case 'kk-latn':
  306. case 'kk-tr':
  307. foreach( $this->mCyrl2Latn as $pat => $rep ) {
  308. $text = preg_replace( $pat, $rep, $text );
  309. }
  310. return $text;
  311. break;
  312. case 'kk-cyrl':
  313. case 'kk-kz':
  314. foreach( $this->mLatn2Cyrl as $pat => $rep ) {
  315. $text = preg_replace( $pat, $rep, $text );
  316. }
  317. return $text;
  318. break;
  319. default:
  320. return $text;
  321. }
  322. }
  323. /*
  324. * We want our external link captions to be converted in variants,
  325. * so we return the original text instead -{$text}-, except for URLs
  326. */
  327. function markNoConversion( $text, $noParse=false ) {
  328. if( $noParse || preg_match( "/^https?:\/\/|ftp:\/\/|irc:\/\//", $text ) )
  329. return parent::markNoConversion( $text );
  330. return $text;
  331. }
  332. function convertCategoryKey( $key ) {
  333. return $this->autoConvert( $key, 'kk' );
  334. }
  335. }
  336. /**
  337. * class that handles Cyrillic, Latin and Arabic scripts for Kazakh
  338. * right now it only distinguish kk_cyrl, kk_latn, kk_arab and kk_kz, kk_tr, kk_cn.
  339. *
  340. * @ingroup Language
  341. */
  342. class LanguageKk extends LanguageKk_cyrl {
  343. function __construct() {
  344. global $wgHooks;
  345. parent::__construct();
  346. $variants = array( 'kk', 'kk-cyrl', 'kk-latn', 'kk-arab', 'kk-kz', 'kk-tr', 'kk-cn' );
  347. $variantfallbacks = array(
  348. 'kk' => 'kk-cyrl',
  349. 'kk-cyrl' => 'kk',
  350. 'kk-latn' => 'kk',
  351. 'kk-arab' => 'kk',
  352. 'kk-kz' => 'kk-cyrl',
  353. 'kk-tr' => 'kk-latn',
  354. 'kk-cn' => 'kk-arab'
  355. );
  356. $this->mConverter = new KkConverter( $this, 'kk', $variants, $variantfallbacks );
  357. $wgHooks['ArticleSaveComplete'][] = $this->mConverter;
  358. }
  359. /**
  360. * Work around for right-to-left direction support in kk-arab and kk-cn
  361. *
  362. * @return bool
  363. */
  364. function isRTL() {
  365. $variant = $this->getPreferredVariant();
  366. if ( $variant == 'kk-arab' || $variant == 'kk-cn' ) {
  367. return true;
  368. } else {
  369. return parent::isRTL();
  370. }
  371. }
  372. /*
  373. * It fixes issue with ucfirst for transforming 'i' to 'İ'
  374. *
  375. */
  376. function ucfirst ( $string ) {
  377. $variant = $this->getPreferredVariant();
  378. if ( ($variant == 'kk-latn' || $variant == 'kk-tr') && $string[0] == 'i' ) {
  379. $string = 'İ' . substr( $string, 1 );
  380. } else {
  381. $string = parent::ucfirst( $string );
  382. }
  383. return $string;
  384. }
  385. /*
  386. * It fixes issue with lcfirst for transforming 'I' to 'ı'
  387. *
  388. */
  389. function lcfirst ( $string ) {
  390. $variant = $this->getPreferredVariant();
  391. if ( ($variant == 'kk-latn' || $variant == 'kk-tr') && $string[0] == 'I' ) {
  392. $string = 'ı' . substr( $string, 1 );
  393. } else {
  394. $string = parent::lcfirst( $string );
  395. }
  396. return $string;
  397. }
  398. function convertGrammar( $word, $case ) {
  399. wfProfileIn( __METHOD__ );
  400. $variant = $this->getPreferredVariant();
  401. switch ( $variant ) {
  402. case 'kk-arab':
  403. case 'kk-cn':
  404. $word = parent::convertGrammarKk_arab( $word, $case );
  405. break;
  406. case 'kk-latn':
  407. case 'kk-tr':
  408. $word = parent::convertGrammarKk_latn( $word, $case );
  409. break;
  410. case 'kk-cyrl':
  411. case 'kk-kz':
  412. case 'kk':
  413. default:
  414. $word = parent::convertGrammarKk_cyrl( $word, $case );
  415. }
  416. wfProfileOut( __METHOD__ );
  417. return $word;
  418. }
  419. }