Modul:chm-translit
Documentation for this module may be created at Modul:chm-translit/belge
-- Ji en.wiktionary "Module:chm-translit"
local export = {}
local tab = {
["А"]="A", ["Б"]="B", ["В"]="V", ["Г"]="G", ["Д"]="D", ["Е"]="E", ["Ё"]="Ë", ["Ж"]="Ž", ["З"]="Z", ["И"]="I", ["Й"]="J",
["К"]="K", ["Л"]="L", ["М"]="M", ["Н"]="N", ["Ҥ"]="Ṅ", ["О"]="O", ["Ӧ"]="Ö", ["П"]="P", ["Р"]="R", ["С"]="S", ["Т"]="T",
["У"]="U", ["Ӱ"]="Ü", ["Ф"]="F", ["Х"]="H", ["Ц"]="C", ["Ч"]="Č", ["Ш"]="Š", ["Щ"]="Ŝ", ["Ъ"]="ʺ", ["Ы"]="Y", ["Ь"]="ʹ",
["Э"]="È", ["Ю"]="Û", ["Я"]="Â",
['а']='a', ['б']='b', ['в']='v', ['г']='g', ['д']='d', ['е']='e', ['ё']='ë', ['ж']='ž', ['з']='z', ['и']='i', ['й']='j',
['к']='k', ['л']='l', ['м']='m', ['н']='n', ['ҥ']='ṅ', ['о']='o', ['ӧ']='ö', ['п']='p', ['р']='r', ['с']='s', ['т']='t',
['у']='u', ['ӱ']='ü', ['ф']='f',
['х']='h', ['ц']='c', ['ч']='č', ['ш']='š', ['щ']='ŝ', ['ъ']='ʺ', ['ы']='y', ['ь']='ʹ', ['э']='è', ['ю']='û', ['я']='â',
-- Hill (Western) Mari only, doesn't use Ҥ, ҥ
["Ӓ"]="Ä", ["Ӹ"]="Ÿ", ['ӓ']='ä', ['ӹ']='ÿ',
}
function export.tr(text)
-- Ё needs converting if is decomposed
text = text:gsub("ё","ё"):gsub("Ё","Ё")
-- е after a vowel or at the beginning of a word becomes je
text = mw.ustring.gsub(text, "([АӒОӦУӰЫӸЕЯЁЮИЕЪЬаӓоӧуӱыӹэяёюиеъь%A][́̀]?)е","%1je")
text = mw.ustring.gsub(text, "^Е","Je")
text = mw.ustring.gsub(text, "^е","je")
text = mw.ustring.gsub(text, "([^Ѐ-ӿ])Е","%1Je")
text = mw.ustring.gsub(text, "([^Ѐ-ӿ])е","%1je")
return (mw.ustring.gsub(text,'.',tab))
end
return export