Module:kim-translit

From Wiktionary, the free dictionary
Jump to navigation Jump to search

A user suggests that this Tofa module be cleaned up.
Please see the discussion on Requests for cleanup(+) for more information and remove this template after the problem has been dealt with.

This module will transliterate Tofa language text. 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:kim-translit/testcases.

Functions

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

local export = {}

local tt = {
	["ү"]="ü",['Ү']='Ü',   ["т"]="t",['Т']='T', ["р"]="r",['Р']='R',   ["ф"]="f",['Ф']='F',
	["ю"]="ju",['Ю']='Ju', ["ш"]="ş",['Ш']='Ş', ["ь"]="ʹ",['Ь']='ʹ',   ["ъ"]="ʺ",['Ъ']='ʺ', ["н"]="n",['Н']='N', 
	["п"]="p",['П']='P',   ["й"]="j",['Й']='J', ["л"]="l",['Л']='L',   ["з"]="z",['З']='Z', ["е"]="e",['Е']='E', 
	["г"]="g",['Г']='G',   ["б"]="b",['Б']='B', ["у"]="u",['У']='U',   ["с"]="s",['С']='S', ["х"]="x",['Х']='X',
	["ч"]="c",['Ч']='C', ["щ"]="ŝ",['Щ']='Ŝ', ["я"]="ja",['Я']='Ja', ["ы"]="y",['Ы']='Y', ["э"]="è",['Э']='È', 
	["м"]="m",['М']='M',   ["о"]="o",['О']='O', ["и"]="i",['И']='I', ["ё"]="ë",['Ё']='Ë', ["ж"]="c",['Ж']='C', 
["і"]='ì', ['І']='Ì',
	["к"]="k",['К']='K',   ["д"]="d",['Д']='D', ["в"]="v",['В']='V', ["ц"]="Ts",['Ц']='ts', ["а"]="a",['А']='A',
	["ӈ"]="ň",['Ӈ']='Ň',   ["ә"]="ä",['Ә']='Ä', ["Ч̡"]="Ç",['ч̡']='ç', ["ӄ"]="q",['Ӄ']="Q",
	["ғ"]="ġ",['Ғ']='Ġ',   ["һ"]="h",['Һ']='H', ["ө"]="ö",['Ө']='Ö'
};

function export.tr(text, lang, sc)
	return (mw.ustring.gsub(text, '.', tt))
end

return export