Bước tới nội dung

Mô đun:rue-translit

Từ điển mở Wiktionary
local export = {}
 
local tt = {
	["А"]='A', ["а"]='a', ["Б"]='B', ["б"]='b', ["В"]='V', ["в"]='v', ["Г"]='H', ["г"]='h', 
	["Ґ"]='G', ["ґ"]='g', ["Д"]='D', ["д"]='d', ["Е"]='E', ["е"]='e', ["Є"]='Je', ["є"]='je', 
	["Ё"]='Jo', ["ё"]='jo', ["Ж"]='Ž', ["ж"]='ž', ["З"]='Z', ["з"]='z', ["І"]='I', ["і"]='i', 
	["Ї"]='Ji', ["ї"]='ji', ["И"]='Y', ["и"]='y', ["Ы"]='Ŷ', ["ы"]='ŷ', ["Й"]='J', ["й"]='j', 
	["К"]='K', ["к"]='k', ["Л"]='L', ["л"]='l', ["М"]='M', ["м"]='m', ["Н"]='N', ["н"]='n', 
	["О"]='O', ["о"]='o', ["П"]='P', ["п"]='p', ["Р"]='R', ["р"]='r', ["С"]='S', ["с"]='s', 
	["Т"]='T', ["т"]='t', ["У"]='U', ["у"]='u', ["Ӱ"]='Ü', ["ӱ"]='ü', ["Ф"]='F', ["ф"]='f', 
	["Х"]='X', ["х"]='x', ["Ц"]='C', ["ц"]='c', ["Ч"]='Č', ["ч"]='č', ["Ш"]='Š', ["ш"]='š', 
	["Щ"]='Šč', ["щ"]='šč', ["Ь"]='ʹ', ["ь"]='ʹ', ["Ю"]='Ju', ["ю"]='ju', ["Я"]='Ja', ["я"]='ja', 
	["Ъ"]='ʺ', ["ъ"]='ʺ', 
	-- neutral apostrophe, right single quotation mark, modifier letter apostrophe → modifier letter double prime
	["’"]='ʺ', ["ʼ"]= 'ʺ', 
	-- obsolete letters
	["О̂"]='Ô', ["о̂"]='ô', ["Э"]='È', ["э"]='è', ["Ѣ"]='Î', ["ѣ"]='î',
}

function export.tr(text, lang, sc)
	text = mw.ustring.gsub(text, "'+", { ["'"] = 'ʺ' })
	return (mw.ustring.gsub(text, '.', tt))
end

return export