Module:ce-translit

ពីWiktionary

Documentation for this module may be created at Module:ce-translit/doc

local export = {}

local tt = {
	["а"]="a", ["б"]="b", ["в"]="w", ["г"]="g", ["д"]="d", ["е"]="e", ["ё"]="ë",
	["ж"]="ž", ["з"]="z", ["и"]="i", ["й"]="j", ["к"]="k", ["л"]="l", ["м"]="m",
	["н"]="n", ["о"]="o", ["п"]="p", ["р"]="r", ["с"]="s", ["т"]="t", ["у"]="u",
	["ф"]="f", ["х"]="χ", ["ц"]="c", ["ч"]="č", ["ш"]="š", ["щ"]="šč", ["ъ"]="ʾ", ["ы"]="y",
	["ь"]="’", ["э"]="e", ["ю"]="ju", ["я"]="ja", ["ӏ"]="ʿ", ["А"]="A", ["Б"]="B", 
	["В"]="W", ["Г"]="G", ["Д"]="D", ["Е"]="E", ["Ё"]="Ë", ["Ж"]="Ž", ["З"]="Z", 
	["И"]="I", ["Й"]="J", ["К"]="K", ["Л"]="L", ["М"]="M", ["Н"]="N", ["О"]="O", 
	["П"]="P", ["Р"]="R", ["С"]="S", ["Т"]="T", ["У"]="U", ["Ф"]="F", ["Х"]="Χ", 
	["Ц"]="C", ["Ч"]="Č", ["Ш"]="Š", ["Щ"]="Šč", ["Ъ"]="ʾ", ["Ы"]="Y", ["Ь"]="’", ["Э"]="E", 
	["Ю"]="Ju", ["Я"]="Ja", ["Ӏ"]="ʿ"};

function export.tr(text, lang, sc)
	text = mw.ustring.gsub(text, 'аь', 'ä')
	text = mw.ustring.gsub(text, 'гӏ', 'ġ')
	text = mw.ustring.gsub(text, 'дж', 'ǯ')
	text = mw.ustring.gsub(text, 'дз', 'ʒ')
	text = mw.ustring.gsub(text, 'ий', 'ī')
	text = mw.ustring.gsub(text, 'кх', 'q')
	text = mw.ustring.gsub(text, 'къ', 'q̇')
	text = mw.ustring.gsub(text, 'кӏ', 'ḳ')
	text = mw.ustring.gsub(text, 'оь', 'ö')
	text = mw.ustring.gsub(text, 'пӏ', 'ṗ')
	text = mw.ustring.gsub(text, 'тӏ', 'ṭ')
	text = mw.ustring.gsub(text, 'уь', 'ü')
	text = mw.ustring.gsub(text, 'хь', 'ḥ')
	text = mw.ustring.gsub(text, 'хӏ', 'h')
	text = mw.ustring.gsub(text, 'цӏ', 'c̣')
	text = mw.ustring.gsub(text, 'чӏ', 'č̣')
	text = mw.ustring.gsub(text, 'юь', 'jü')
	text = mw.ustring.gsub(text, 'яь', 'jä')
	text = mw.ustring.gsub(text, 'Аь', 'Ä')
	text = mw.ustring.gsub(text, 'Гӏ', 'Ġ')
	text = mw.ustring.gsub(text, 'Дж', 'Ǯ')
	text = mw.ustring.gsub(text, 'Дз', 'Ʒ')
	text = mw.ustring.gsub(text, 'Ий', 'Ī')
	text = mw.ustring.gsub(text, 'Кх', 'Q')
	text = mw.ustring.gsub(text, 'Къ', 'Q̇')
	text = mw.ustring.gsub(text, 'Кӏ', 'Ḳ')
	text = mw.ustring.gsub(text, 'Оь', 'Ö')
	text = mw.ustring.gsub(text, 'Пӏ', 'Ṗ')
	text = mw.ustring.gsub(text, 'Тӏ', 'Ṭ')
	text = mw.ustring.gsub(text, 'Уь', 'Ü')
	text = mw.ustring.gsub(text, 'Хь', 'Ḥ')
	text = mw.ustring.gsub(text, 'Хӏ', 'H')
	text = mw.ustring.gsub(text, 'Цӏ', 'C̣')
	text = mw.ustring.gsub(text, 'Чӏ', 'Č̣')
	text = mw.ustring.gsub(text, 'Юь', 'Jü')
	text = mw.ustring.gsub(text, 'Яь', 'Jä')
	text = mw.ustring.gsub(text, '.', tt)
	
	return text
end

return export