Modul:nog-translit

Wiktionary saytından

Bu modulun sənədləşdirmə səhifəsi Modul:nog-translit/doc səhifəsində yaradıla bilər

local export = {}

local tt = {
	["а"]="a", ["б"]="b", ["в"]="v", ["г"]="g", ["д"]="d", ["е"]="e", ["ё"]="yo", ["ж"]="j",
	["з"]="z", ["и"]="i", ["й"]="y", ["к"]="k", ["л"]="l", ["м"]="m", ["н"]="n", ["о"]="o", 
	["п"]="p", ["р"]="r", ["с"]="s", ["т"]="t", ["у"]="u", ["ф"]="f", ["х"]="x", ["ц"]="c", 
	["ч"]="ç", ["ш"]="ş", ["щ"]="şç", ["ъ"]="”", ["ы"]="ı", ["ь"]="’", ["э"]="é", ["ю"]="yu",
	["я"]="ya", ["А"]="A", ["Б"]="B", ["В"]="V", ["Г"]="G", ["Д"]="D", ["Е"]="E", ["Ё"]="Yo", ["Ж"]="J",
	["З"]="Z", ["И"]="I", ["Й"]="Y", ["К"]="K", ["Л"]="L", ["М"]="M", ["Н"]="N", ["О"]="O", 
	["П"]="P", ["Р"]="R", ["С"]="S", ["Т"]="T", ["У"]="U", ["Ф"]="F", ["Х"]="X", ["Ц"]="C", 
	["Ч"]="Ç", ["Ш"]="Ş", ["Щ"]="Şç", ["Ъ"]="”", ["Ы"]="I", ["Ь"]="’", ["Э"]="É", ["Ю"]="Yu",
	["Я"]="Ya"};

function export.tr(text)
	text = mw.ustring.gsub(
			text, "([АОУЫЕЯЁЮИЕаоуыэяёюиеь%A][́̀]?)([Ее])",
			function(a,e) return a..(e=='е' and 'ye' or 'Ye') end
		):gsub("^Е",'Ye'):gsub("^е",'ye');
	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, 'уь', 'ü')
	text = mw.ustring.gsub(text, 'Уь', 'Ü')
	text = mw.ustring.gsub(text, '.', tt)
	
	return text
end

return export