User:AlefZet/crh/LanguageCrh.inc

From Wikimedia Incubator
Jump to navigation Jump to search

/*

*/
<?php
/**
 * Crimean Tatar (Qırımtatarca)
 * conversion rules
 * 
 *
 *
 * @package MediaWiki
*/

/**
 * toCyrillic conversion rules
 *
 * @$patCrh_latn
 * @$repCrh_cyrl
 *
*/

# Latin character sets

$nConsonantsCrh_latn = 'çnrstzÇNRSTZ';
$mConsonantsCrh_latn = 'bcgkmpşBCGKMPŞ';
$upperConsonantsCrh_latn= 'BCÇDFGHJKLMNÑPRSŞTVZ';
$lowerConsonantsCrh_latn = 'bcçdfghjklmnñprsştvz';
$allConsonantsCrh_latn = $lowerConsonantsCrh_latn.$upperConsonantsCrh_latn;

$upperFrontVowelsCrh_latn = 'EİÖÜ';
$upperBackVowelsCrh_latn = 'AIOU';
$lowerFrontVowelsCrh_latn = 'eiöü';
$lowerBackVowelsCrh_latn = 'aıou';
$upperVowelsCrh_latn = $upperFrontVowelsCrh_latn.$upperBackVowelsCrh_latn.'Y';
$lowerVowelsCrh_latn = $lowerFrontVowelsCrh_latn.$lowerBackVowelsCrh_latn.'y';
$allVowelsCrh_latn= $lowerVowelsCrh_latn.$upperVowelsCrh_latn;

$allUppersCrh_latn = $upperConsonantsCrh_latn.$upperVowelsCrh_latn;
$allLowersCrh_latn = $lowerConsonantsCrh_latn.$lowerVowelsCrh_latn;


# patterns and replacements
#

$patCrh_latn = array();
$repCrh_cyrl = array();


# 0. словарик
#

# 0.A некоторые случаи употребления буквы ц

# ц-

$patCrh_latn[] = '/^ts/';
$repCrh_cyrl[] = 'ц';

$patCrh_latn[] = '/^T[sS]/';
$repCrh_cyrl[] = 'Ц';

# -ц

$patCrh_latn[] = '/ts$/';
$repCrh_cyrl[] = 'ц';

$patCrh_latn[] = '/T[sS]$/';
$repCrh_cyrl[] = 'Ц';

# -ци-

$patCrh_latn[] = '/tsi([^z])/';
$repCrh_cyrl[] = 'ци$1';

$patCrh_latn[] = '/T[sS][iİ]([^zZ])/';
$repCrh_cyrl[] = 'ЦИ$1';

# -цо-, -цу-

$patCrh_latn[] = '/ts([ou])/';
$repCrh_cyrl[] = 'ц$1';

$patCrh_latn[] = '/T[sS]([oOuU])/';
$repCrh_cyrl[] = 'Ц$1';

# - ц согл. -

$patCrh_latn[] = '/ts(['.$allConsonantsCrh_latn.'])/';
$repCrh_cyrl[] = 'ц$1';

$patCrh_latn[] = '/T[sS](['.$allConsonantsCrh_latn.'])/';
$repCrh_cyrl[] = 'Ц$1';

# - согл. ц -

$patCrh_latn[] = '/(['.$allConsonantsCrh_latn.'])ts/';
$repCrh_cyrl[] = '$1ц';

$patCrh_latn[] = '/(['.$allConsonantsCrh_latn.'])T[sS]/';
$repCrh_cyrl[] = '$1Ц';

# 4. расставляем буквы э
$patCrh_latn[] = '/^e/';
$repCrh_cyrl[] = 'э';

$patCrh_latn[] = '/^E/';
$repCrh_cyrl[] = 'Э';

$patCrh_latn[] = '/(['.$allVowelsCrh_cyrl.'])e/';
$repCrh_cyrl[] = '$1э';

$patCrh_latn[] = '/(['.$upperVowelsCrh_latn.'])E/';
$repCrh_cyrl[] = '$1Э';

# 1. буквы гъ, къ, нъ, дж

$patCrh_latn[] = '/ğ/';
$repCrh_cyrl[] = 'гъ';

$patCrh_latn[] = '/Ğ(['.$allLowersCrh_latn.'])/';
$repCrh_cyrl[] = 'Гъ$1';

$patCrh_latn[] = '/Ğ(['.$allUppersCrh_latn.'])/';
$repCrh_cyrl[] = 'ГЪ$1';

$patCrh_latn[] = '/(['.$allUppersCrh_latn.'])Ğ/';
$repCrh_cyrl[] = '$1ГЪ';

$patCrh_latn[] = '/q/';
$repCrh_cyrl[] = 'къ';

$patCrh_latn[] = '/Q(['.$allLowersCrh_latn.'])/';
$repCrh_cyrl[] = 'Къ$1';

$patCrh_latn[] = '/Q(['.$allUppersCrh_latn.'])/';
$repCrh_cyrl[] = 'КЪ$1';

$patCrh_latn[] = '/(['.$allUppersCrh_latn.'])Q/';
$repCrh_cyrl[] = '$1КЪ';

$patCrh_latn[] = '/ñ/';
$repCrh_cyrl[] = 'нъ';

$patCrh_latn[] = '/Ñ(['.$allLowersCrh_latn.'])/';
$repCrh_cyrl[] = 'Нъ$1';

$patCrh_latn[] = '/Ñ(['.$allUppersCrh_latn.'])/';
$repCrh_cyrl[] = 'НЪ$1';

$patCrh_latn[] = '/(['.$allUppersCrh_latn.'])Ñ/';
$repCrh_cyrl[] = '$1НЪ';

# 9. буква c

$patCrh_latn[] = '/c/';
$repCrh_cyrl[] = 'дж';

$patCrh_latn[] = '/C(['.$allLowersCrh_latn.'])/';
$repCrh_cyrl[] = 'Дж$1';

$patCrh_latn[] = '/C(['.$allUppersCrh_latn.'])/';
$repCrh_cyrl[] = 'ДЖ$1';

$patCrh_latn[] = '/(['.$allUppersCrh_latn.'])C/';
$repCrh_cyrl[] = '$1ДЖ';

# 2. расставляем Ь после Л

$patCrh_latn[] = '/(['.$lowerFrontVowelsCrh_latn.$upperFrontVowelsCrh_latn.'])l(['.$lowerConsonantsCrh_latn.'])/';
$repCrh_cyrl[] = '$1ль$2';

$patCrh_latn[] = '/(['.$upperFrontVowelsCrh_latn.'])L(['.$allConsonantsCrh_latn.'])/';
$repCrh_cyrl[] = '$1ЛЬ$2';

$patCrh_latn[] = '/(['.$lowerFrontVowelsCrh_latn.$upperFrontVowelsCrh_latn.'])l$/';
$repCrh_cyrl[] = '$1ль';

$patCrh_latn[] = '/(['.$upperFrontVowelsCrh_latn.'])L$/';
$repCrh_cyrl[] = '$1ЛЬ';

# 3. обрабатываем ya и ye


# ya

$patCrh_latn[] = '/(['.$allConsonantsCrh_latn.'])ya/';
$repCrh_cyrl[] = '$1ья';

$patCrh_latn[] = '/(['.$allConsonantsCrh_latn.'])Y[aA]/';
$repCrh_cyrl[] = '$1ЬЯ';

$patCrh_latn[] = '/ya/';
$repCrh_cyrl[] = 'я';

$patCrh_latn[] = '/Y[aA]/';
$repCrh_cyrl[] = 'Я';


# ye

$patCrh_latn[] = '/(['.$allConsonantsCrh_latn.'])ye/';
$repCrh_cyrl[] = '$1ье';

$patCrh_latn[] = '/(['.$allConsonantsCrh_latn.'])Y[eE]/';
$repCrh_cyrl[] = '$1ЬЕ';

$patCrh_latn[] = '/ye/';
$repCrh_cyrl[] = 'е';

$patCrh_latn[] = '/Y[eE]/';
$repCrh_cyrl[] = 'Е';




# 6. обрабатываем bo'- bu'- и т.д. в первом слоге

# 6.1. случаи, когда нужен мягкий знак

# о

$patCrh_latn[] = '/^(['.$mConsonantsCrh_latn.'])ö(['.$nConsonantsCrh_latn.'])([aAuU'.$allConsonantsCrh_latn.'])$/';
$repCrh_cyrl[] = '$1о$2ь$3';


$patCrh_latn[] = '/^(['.$mConsonantsCrh_latn.'])Ö(['.$nConsonantsCrh_latn.'])([aAuU'.$allConsonantsCrh_latn.'])$/';
$repCrh_cyrl[] = '$1О$2Ь$3';


# у

$patCrh_latn[] = '/^(['.$mConsonantsCrh_latn.'])ü(['.$nConsonantsCrh_latn.'])([aAuU'.$allConsonantsCrh_latn.'])$/';
$repCrh_cyrl[] = '$1у$2ь$3';


$patCrh_latn[] = '/^(['.$mConsonantsCrh_latn.'])Ü(['.$nConsonantsCrh_latn.'])([aAuU'.$allConsonantsCrh_latn.'])$/';
$repCrh_cyrl[] = '$1У$2Ь$3';



# 6.2. случаи, когда мягкий знак не нужен

# о

$patCrh_latn[] = '/^(['.$mConsonantsCrh_latn.'])ö/';
$repCrh_cyrl[] = '$1о';


$patCrh_latn[] = '/^(['.$mConsonantsCrh_latn.'])Ö/';
$repCrh_cyrl[] = '$1О';

# у

$patCrh_latn[] = '/^(['.$mConsonantsCrh_latn.'])ü/';
$repCrh_cyrl[] = '$1у';

$patCrh_latn[] = '/^(['.$mConsonantsCrh_latn.'])Ü/';
$repCrh_cyrl[] = '$1У';

# 5. буквы ё и ю - первый заход

# ю

# расставляем мягкие знаки после согласных

$patCrh_latn[] = '/^([yY])ü(['.$nConsonantsCrh_latn.'])([aAuU'.$allConsonantsCrh_latn.'])$/';
$repCrh_cyrl[] = '$1ü$2ь$3';


$patCrh_latn[] = '/^([yY])Ü(['.$nConsonantsCrh_latn.'])([aAuU'.$allConsonantsCrh_latn.'])$/';
$repCrh_cyrl[] = '$1Ü$2Ь$3';


# расставляем мягкие знаки перед ю

$patCrh_latn[] = '/(['.$allConsonantsCrh_latn.'])y[uü]/';
$repCrh_cyrl[] = '$1ью';

$patCrh_latn[] = '/(['.$allConsonantsCrh_latn.'])Y[uüUÜ]/';
$repCrh_cyrl[] = '$1ЬЮ';

# обрабатываем остальные вхождения ю

$patCrh_latn[] = '/y[uü]/';
$repCrh_cyrl[] = 'ю';

$patCrh_latn[] = '/Y[uüUÜ]/';
$repCrh_cyrl[] = 'Ю';

//$patCrh_latn[] = '/[yY][uüUÜ]/';
//$repCrh_cyrl[] = 'Ю';

# ё

# расставляем мягкие знаки после согласных

$patCrh_latn[] = '/^([yY])ö(['.$nConsonantsCrh_latn.'])([aAuU'.$allConsonantsCrh_latn.'])$/';
$repCrh_cyrl[] = '$1ö$2ь$3';


$patCrh_latn[] = '/^([yY])Ö(['.$nConsonantsCrh_latn.'])([aAuU'.$allConsonantsCrh_latn.'])$/';
$repCrh_cyrl[] = '$1Ö$2Ь$3';


# расставляем мягкие знаки перед ё

$patCrh_latn[] = '/(['.$allConsonantsCrh_latn.'])y[oö]/';
$repCrh_cyrl[] = '$1ьё';

$patCrh_latn[] = '/(['.$allConsonantsCrh_latn.'])Y[oöOÖ]/';
$repCrh_cyrl[] = '$1ЬЁ';

# обрабатываем остальные вхождения ё

$patCrh_latn[] = '/y[oö]/';
$repCrh_cyrl[] = 'ё';

$patCrh_latn[] = '/Y[oöOÖ]/';
$repCrh_cyrl[] = 'Ё';

//$patCrh_latn[] = '/[yY][oöOÖ]/';
//$repCrh_cyrl[] = 'Ё';


# 7. обрабатываем o' и u' в начале слова

# 7.1. случаи, когда мягкий знак нужен

# у

$patCrh_latn[] = '/^ü(['.$nConsonantsCrh_latn.'])([aAuU'.$allConsonantsCrh_latn.'])$/';
$repCrh_cyrl[] = 'у$1ь$2';


$patCrh_latn[] = '/^Ü([çnprstz])([aAuU'.$allConsonantsCrh_latn.'])$/';
$repCrh_cyrl[] = 'У$1ь$2';


$patCrh_latn[] = '/^Ü([ÇNPRSTZ])([aAuU'.$allConsonantsCrh_latn.'])$/';
$repCrh_cyrl[] = 'У$1Ь$2';

# о

$patCrh_latn[] = '/^ö(['.$nConsonantsCrh_latn.'])([aAuU'.$allConsonantsCrh_latn.'])$/';
$repCrh_cyrl[] = 'о$1ь$2';


$patCrh_latn[] = '/^Ö([çnprstz])([aAuU'.$allConsonantsCrh_latn.'])$/';
$repCrh_cyrl[] = 'О$1ь$2';


$patCrh_latn[] = '/^Ö([ÇNPRSTZ])([aAuU'.$allConsonantsCrh_latn.'])$/';
$repCrh_cyrl[] = 'О$1Ь$2';

# 7.2. случаи, когда мягкий знак не нужен

# у

$patCrh_latn[] = '/^ü/';
$repCrh_cyrl[] = 'у';

$patCrh_latn[] = '/^Ü/';
$repCrh_cyrl[] = 'У';

# о

$patCrh_latn[] = '/^ö/';
$repCrh_cyrl[] = 'о';

$patCrh_latn[] = '/^Ö/';
$repCrh_cyrl[] = 'О';

# 8. все оставшиеся вхождения букв a, e, o, o', u, u', y

$patCrh_latn[] = '/a/';
$repCrh_cyrl[] = 'а';

$patCrh_latn[] = '/A/';
$repCrh_cyrl[] = 'А';

$patCrh_latn[] = '/e/';
$repCrh_cyrl[] = 'е';

$patCrh_latn[] = '/E/';
$repCrh_cyrl[] = 'Е';

$patCrh_latn[] = '/o/';
$repCrh_cyrl[] = 'о';

$patCrh_latn[] = '/O/';
$repCrh_cyrl[] = 'О';

$patCrh_latn[] = '/u/';
$repCrh_cyrl[] = 'у';

$patCrh_latn[] = '/U/';
$repCrh_cyrl[] = 'У';

$patCrh_latn[] = '/ü/';
$repCrh_cyrl[] = 'ю';

$patCrh_latn[] = '/Ü/';
$repCrh_cyrl[] = 'Ю';

$patCrh_latn[] = '/ö/';
$repCrh_cyrl[] = 'ё';

$patCrh_latn[] = '/Ö/';
$repCrh_cyrl[] = 'Ё';


$patCrh_latn[] = '/y/';
$repCrh_cyrl[] = 'й';

$patCrh_latn[] = '/Y/';
$repCrh_cyrl[] = 'Й';




# 10. все остальные буквы

# строчные


$patCrh_latn[] = '/â/';
$repCrh_cyrl[] = 'я';

$patCrh_latn[] = '/b/';
$repCrh_cyrl[] = 'б';

$patCrh_latn[] = '/ç/';
$repCrh_cyrl[] = 'ч';

$patCrh_latn[] = '/d/';
$repCrh_cyrl[] = 'д';

$patCrh_latn[] = '/f/';
$repCrh_cyrl[] = 'ф';

$patCrh_latn[] = '/g/';
$repCrh_cyrl[] = 'г';

$patCrh_latn[] = '/h/';
$repCrh_cyrl[] = 'х';

$patCrh_latn[] = '/ı/';
$repCrh_cyrl[] = 'ы';

$patCrh_latn[] = '/i/';
$repCrh_cyrl[] = 'и';

$patCrh_latn[] = '/j/';
$repCrh_cyrl[] = 'ж';

$patCrh_latn[] = '/k/';
$repCrh_cyrl[] = 'к';

$patCrh_latn[] = '/l/';
$repCrh_cyrl[] = 'л';

$patCrh_latn[] = '/m/';
$repCrh_cyrl[] = 'м';

$patCrh_latn[] = '/n/';
$repCrh_cyrl[] = 'н';

$patCrh_latn[] = '/p/';
$repCrh_cyrl[] = 'п';

$patCrh_latn[] = '/r/';
$repCrh_cyrl[] = 'р';

$patCrh_latn[] = '/s/';
$repCrh_cyrl[] = 'с';

$patCrh_latn[] = '/ş/';
$repCrh_cyrl[] = 'ш';

$patCrh_latn[] = '/t/';
$repCrh_cyrl[] = 'т';

$patCrh_latn[] = '/v/';
$repCrh_cyrl[] = 'в';

$patCrh_latn[] = '/z/';
$repCrh_cyrl[] = 'з';

# заглавные

$patCrh_latn[] = '/Â/';
$repCrh_cyrl[] = 'Я';

$patCrh_latn[] = '/B/';
$repCrh_cyrl[] = 'Б';

$patCrh_latn[] = '/Ç/';
$repCrh_cyrl[] = 'Ч';

$patCrh_latn[] = '/D/';
$repCrh_cyrl[] = 'Д';

$patCrh_latn[] = '/F/';
$repCrh_cyrl[] = 'Ф';

$patCrh_latn[] = '/G/';
$repCrh_cyrl[] = 'Г';

$patCrh_latn[] = '/H/';
$repCrh_cyrl[] = 'Х';

$patCrh_latn[] = '/I/';
$repCrh_cyrl[] = 'Ы';

$patCrh_latn[] = '/İ/';
$repCrh_cyrl[] = 'И';

$patCrh_latn[] = '/J/';
$repCrh_cyrl[] = 'Ж';

$patCrh_latn[] = '/K/';
$repCrh_cyrl[] = 'К';

$patCrh_latn[] = '/L/';
$repCrh_cyrl[] = 'Л';

$patCrh_latn[] = '/M/';
$repCrh_cyrl[] = 'М';

$patCrh_latn[] = '/N/';
$repCrh_cyrl[] = 'Н';

$patCrh_latn[] = '/P/';
$repCrh_cyrl[] = 'П';

$patCrh_latn[] = '/R/';
$repCrh_cyrl[] = 'Р';

$patCrh_latn[] = '/S/';
$repCrh_cyrl[] = 'С';

$patCrh_latn[] = '/Ş/';
$repCrh_cyrl[] = 'Ш';

$patCrh_latn[] = '/T/';
$repCrh_cyrl[] = 'Т';

$patCrh_latn[] = '/V/';
$repCrh_cyrl[] = 'В';

$patCrh_latn[] = '/Z/';
$repCrh_cyrl[] = 'З';

$patCrh_latn[] = '/ЮЮ/';
$repCrh_cyrl[] = 'УЮ';

$patCrh_latn[] = '/Юю/';
$repCrh_cyrl[] = 'Ую';

$patCrh_latn[] = '/юю/';
$repCrh_cyrl[] = 'ую';


# 11. убираем сочетания льл, ньн, рьр, сьс, тьт


$patCrh_latn[] = '/льл/';
$repCrh_cyrl[] = 'лл';

$patCrh_latn[] = '/Л[ьЬ]л/';
$repCrh_cyrl[] = 'Лл';

$patCrh_latn[] = '/ЛЬЛ/';
$repCrh_cyrl[] = 'ЛЛ';

$patCrh_latn[] = '/ньн/';
$repCrh_cyrl[] = 'нн';

$patCrh_latn[] = '/Н[ьЬ]н/';
$repCrh_cyrl[] = 'Нн';

$patCrh_latn[] = '/НЬН/';
$repCrh_cyrl[] = 'НН';

$patCrh_latn[] = '/рьр/';
$repCrh_cyrl[] = 'рр';

$patCrh_latn[] = '/Р[ьЬ]р/';
$repCrh_cyrl[] = 'Рр';

$patCrh_latn[] = '/РЬР/';
$repCrh_cyrl[] = 'РР';

$patCrh_latn[] = '/сьс/';
$repCrh_cyrl[] = 'сс';

$patCrh_latn[] = '/С[ьЬ]с/';
$repCrh_cyrl[] = 'Сс';

$patCrh_latn[] = '/СЬС/';
$repCrh_cyrl[] = 'СС';

$patCrh_latn[] = '/тьт/';
$repCrh_cyrl[] = 'тт';

$patCrh_latn[] = '/Т[ьЬ]т/';
$repCrh_cyrl[] = 'Тт';

$patCrh_latn[] = '/ТЬТ/';
$repCrh_cyrl[] = 'ТТ';


$patCrh_latn[] = '/ТЬТ/';
$repCrh_cyrl[] = 'ТТ';


/**
 * toLatin conversion rules
 *
 * @$patCrh_cyrl
 * @$repCrh_latn
 *
*/

# Cyrillic character sets
# placeholder

# patterns and replacements
#
$patCrh_cyrl = array();
$repCrh_latn = array();

?>
/*

*/