Module:av-translit

Definition from Wiktionary, the free dictionary
Jump to: navigation, search
The following documentation is located at Module:av-translit/documentation. [edit]
Useful links: subpage listtransclusionstestcases

This module will transliterate Avar language text per WT:AV TR.

The module should preferably not be called directly from templates or other modules. To use it from a template, use {{xlit}}. Within a module, use Module:languages#Language:transliterate.

For testcases, see Module:av-translit/testcases.

Functions[edit]

tr(text, lang, sc)
Transliterates a given piece of text written in the script specified by sc, and language specified by lang. When the transliteration fails, returns nil.

local export = {}
 
local tt = {
	["б"]="b", ["п"]="p", ["ф"]="f", ["в"]="w", ["м"]="m",
	["д"]="d", ["т"]="t", ["й"]="j", ["н"]="n", ["з"]="z", ["ц"]="c",
	["с"]="s", ["ж"]="ž", ["ш"]="š", ["щ"]="š̄", 
	["л"]="l", ["ч"]="č", ["р"]="r", ["г"]="g", ["к"]="k", ["х"]="χ", 
	["ъ"]="ʾ", ["а"]="a", ["е"]="e", ["ы"]="ə", ["и"]="i", ["о"]="o", ["у"]="u", 
	["ё"]="ë", ["ь"]="’", ["э"]="è", ["ю"]="ju", ["я"]="ja",
	["Б"]="B", ["П"]="P", ["Ф"]="F", ["В"]="W", ["М"]="M",
	["Д"]="D", ["Т"]="T", ["Й"]="J", ["Н"]="N", ["З"]="Z", ["Ц"]="C",
	["С"]="S", ["Ж"]="Ž", ["Ш"]="Š", ["Щ"]="Š̄", 
	["Л"]="L", ["Ч"]="Č", ["Р"]="R", ["Г"]="G", ["К"]="K", ["Х"]="Χ", 
	["Ъ"]="ʾ", ["А"]="A", ["Е"]="E", ["Ы"]="Ə", ["И"]="I", ["О"]="O", ["У"]="U", 
	["Ё"]="Ë", ["Ь"]="’", ["Э"]="È", ["Ю"]="Ju", ["Я"]="Ja"};
 
function export.tr(text, lang, sc)
	text = mw.ustring.gsub(text, 'цӏцӏ', 'c̣̄')
	text = mw.ustring.gsub(text, 'чӏчӏ', 'č̣̄')
	text = mw.ustring.gsub(text, 'кӏкӏ', 'ḳ̄')
	text = mw.ustring.gsub(text, 'лълъ', 'ł̄')
	text = mw.ustring.gsub(text, 'Цӏцӏ', 'C̣̄')
	text = mw.ustring.gsub(text, 'Чӏчӏ', 'Č̣̄')
	text = mw.ustring.gsub(text, 'Кӏкӏ', 'Ḳ̄')
	text = mw.ustring.gsub(text, 'Лълъ', 'Ł̄')
	text = mw.ustring.gsub(text, 'цӏ', 'c̣')
	text = mw.ustring.gsub(text, 'цц', 'c̄')
	text = mw.ustring.gsub(text, 'тӏ', 'ṭ')
	text = mw.ustring.gsub(text, 'лӏ', 'kl')
	text = mw.ustring.gsub(text, 'сс', 's̄')
	text = mw.ustring.gsub(text, 'лъ', 'ł')
	text = mw.ustring.gsub(text, 'чч', 'č̄')
	text = mw.ustring.gsub(text, 'чӏ', 'č̣')
	text = mw.ustring.gsub(text, 'кь', 'kḷ')
	text = mw.ustring.gsub(text, 'кк', 'k̄')
	text = mw.ustring.gsub(text, 'кӏ', 'ḳ')
	text = mw.ustring.gsub(text, 'хь', 'x')
	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, 'гь', 'h')
	text = mw.ustring.gsub(text, 'Цӏ', 'C̣')
	text = mw.ustring.gsub(text, 'Цц', 'C̄')
	text = mw.ustring.gsub(text, 'Тӏ', 'Ṭ')
	text = mw.ustring.gsub(text, 'Лӏ', 'Kl')
	text = mw.ustring.gsub(text, 'Сс', 'S̄')
	text = mw.ustring.gsub(text, 'Лъ', 'Ł')
	text = mw.ustring.gsub(text, 'Чч', 'Č̄')
	text = mw.ustring.gsub(text, 'Чӏ', 'Č̣')
	text = mw.ustring.gsub(text, 'Кь', 'Kḷ')
	text = mw.ustring.gsub(text, 'Кк', 'K̄')
	text = mw.ustring.gsub(text, 'Кӏ', 'Ḳ')
	text = mw.ustring.gsub(text, 'Хь', 'X')
	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, 'Гь', 'H')
	text = mw.ustring.gsub(text, '.', tt)
 
	return text
end
 
return export