Module:User:Crom daba/ket-translit

local u = mw.ustring.char

local MACRON   = u(0x0304) local DOTABOVE = u(0x0307) local DOTBELOW = u(0x0323)

local str_gsub, ugsub = string.gsub, mw.ustring.gsub local UTF8char = '[\1-\127\194-\244][\128-\191]*'

local export = {}

local tab = { ["А"]='A', ["а"]='a', ["Б"]='B', ["б"]='b', ["В"]='V', ["в"]='V', ["Г"]='G', ["г"]='g', ["Д"]='D', ["д"]='d', ["Е"]='E', ["е"]='e', ["Ё"]='Jo', ["ё"]='jo',	["Ж"]='Z', ["ж"]='z', ["З"]='Z', ["з"]='z', ["И"]='I', ["и"]='i', ["Й"]='J', ["й"]='j', ["К"]='K', ["к"]='k', ["Ӄ"]='Q', ["ӄ"]='q', ["Л"]='L', ["л"]='l', ["М"]='M', ["м"]='m', ["Н"]='N', ["н"]='n', ["Ӈ"]='Ŋ', ["ӈ"]='ŋ', ["О"]='O', ["о"]='o', ["Ө"]='Ọ ', ["ө"]='̣ o', ["П"]='P', ["п"]='p', ["Р"]='R', ["р"]='r', ["С"]='S', ["с"]='s', ["Т"]='T', ["т"]='t', ["У"]='U', ["у"]='u', ["Ф"]='F', ["ф"]='f', ["Х"]='H', ["х"]='h', ["Ц"]='C', ["ц"]='c', ["Ч"]='Č', ["ч"]='č', ["Ш"]='Š', ["ш"]='š',	["Щ"]='Šč', ["щ"]='šč', ['Ъ']='Ə', ['ъ']='ə', ['Ә']='Ə̣', ['ә']='ə̣', ["Ы"]='Y', ["ы"]='y', ["Ь"]='ʼ', ["ь"]="ʼ", ['ʼ']='ˀ', ["Э"]='E', ["э"]='e', ["Ю"]='Ju', ["ю"]='ju', ["Я"]='Ja', ["я"]='ja',

} function export.tr(text, lang, sc) for i, replacement in ipairs(other) do		text = str_gsub(text, unpack(replacement)) end

text = ugsub(text,		"([АОУЫЕИӢЪЬаӣиоуыэеъьaeiou]["..MACRON..DOTABOVE..DOTBELOW.."]?)е",		"%1je") text = ugsub(text,   	"([АОУЫЕИӢЪЬаӣиоуыэеъьaeiou]["..MACRON..DOTABOVE..DOTBELOW.."]?)и",    	"%1ji") text = str_gsub(text, "^Е","Ẹ") text = str_gsub(text, "^е","ẹ") text = ugsub(text, "([^Ѐ-ӿ])Е","%1Ẹ") text = ugsub(text, "([^Ѐ-ӿ])е","%1ẹ") return (str_gsub(text, UTF8char, tab)) end

return export