Module:uum-translit

Definition from Wiktionary, the free dictionary
Jump to: navigation, search

local export = {}
local tab =  
             {["А"] ="A" ,    ["Б"] ="B",   ["В"] ="V",   ["Г"] ="G",   ["Д"] ="D",   ["Е"] ="E",                                           ["Ё"] ="Yo", ["Ж"] ="C" ,    ["З"] ="Z",   ["И"] ="I",   ["Й"] ="Y",
	
     ["К"]="K",  ["Л"]="L", ["М"]="M", ["Н"]="N",  ["Ҥ"]="Ñ", ["О"]="O",  ["Ө"]="Ö", ["П"]="P", ["Р"]="R", ["С"]="S",  ["Т"]="T",
["У"]="U",  ["Ү"]="Ü", ["Ф"]="F", ["Х"]="KH", ["Һ"]="H", ["Ц"]="Ts",["Ч"]="Ć", ["Ш"]="Ś",     ["Щ"]="Śç", ["Ъ"]="ʺ", ["Ы"]="İ",
["Ь"]="ʹ", ["Э"]="E", ["Ю"]="Yu", ["Я"]="Ya",
['а']='a', ['б']='b', ['в']='v', ['г']='g',  ['д']='d', ['е']='e',  ['ё']='yo', ['ж']='c', ['з']='z', ['и']='i', ['й']='y',
['к']='k', ['л']='l', ['м']='m', ['н']='n',  ['о']='o', ['ө']='ö',  ['п']='p',  ['р']='r', ['с']='s', ['т']='t',
['у']='u', ['ү']='ü', ['ф']='f', ['х']='kh', ['һ']='h', ['ц']='ts', ['ч']='ć',  ['ш']='ś', ['щ']='śç',['ъ']='ʺ', ['ы']='ı',
['ь']='ʹ', ['э']='e', ['ю']='yu', ['я']='ya',
}
local mapping = { ['дж']= 'j' , ['Дж']= 'J', ['ң']='ñ' ,['Ң']='Ñ' ,
                  ['ть']='ţ',   ['Ть']='Ţ' , ['нъ']='ñ',['НЪ']='Ñ'

}
function export.tr(text, lang, sc)
	-- Ё needs converting if is decomposed
	text = text:gsub("ё","ё"):gsub("Ё","Ё")
 
	-- е after a vowel or at the beginning of a text becomes ye
	text = mw.ustring.gsub(text, "([АОӨУҮЫЕЯЁЮИЕЪЬаоөуүыэяёюиеъь%A][\204\129\204\128]?)е","%1yö")
	text = mw.ustring.gsub(text, "^Е","Yö")
	text = mw.ustring.gsub(text, "^е","yö")
	text = mw.ustring.gsub(text, "([^Ѐ-ӿ])Е","%1yö")
	text = mw.ustring.gsub(text, "([^Ѐ-ӿ])е","%1yö")
 
	return (mw.ustring.gsub(text,'.',tab))
end
 
return export