Module:kca-translit

This module will transliterate text in one of the Khanty languages per WT:KCA TR. It is also used to transliterate Eastern Khanty, Northern Khanty, and Southern Khanty. 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:kca-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 = {
	["А"]="A", ["Ӓ"]="Ä", ["Ӑ"]="Ă", ["Б"]="B", ["В"]="W", ["Г"]="G", ["Д"]="D",
	["а"]="a", ["ӓ"]="ä", ["ӑ"]="ă", ["б"]="b", ["в"]="w", ["г"]="g", ["д"]="d",
	["Е"]="Je",["Ё"]="Jo",["Ә"]="Ə", ["Ӛ"]="Jə",["Ж"]="Ž", ["З"]="Z", ["И"]="I",
	["е"]="je",["ё"]="jo",["ә"]="ə", ["ӛ"]="jə",["ж"]="ž", ["з"]="z", ["и"]="i",
	["І"]="I", ["Й"]="J", ["К"]="K", ["Қ"]="Ḳ", ["Ӄ"]="Ḳ", ["Л"]="L", ["Ԯ"]="Ł",
	["і"]="i", ["й"]="j", ["к"]="k", ["қ"]="ḳ", ["ӄ"]="ḳ", ["л"]="l", ["ԯ"]="ł",
	["Ԓ"]="Ł", ["Љ"]="Lj",["М"]="M", ["Н"]="N", ["Ң"]="Ṇ", ["Ӈ"]="Ṇ", ["Њ"]="Nj",
	["ԓ"]="ł", ["љ"]="lj",["м"]="m", ["н"]="n", ["ң"]="ṇ", ["ӈ"]="ṇ", ["њ"]="nj",
	["Ԋ"]="Nj",["О"]="O", ["Ӧ"]="Ö", ["Ө"]="Ø", ["Ӫ"]="Ø̈", ["Ө̆"]="Ø̆", ["П"]="P",
	["ԋ"]="nj",["о"]="o", ["ӧ"]="ö", ["ө"]="ø", ["ӫ"]="ø̈", ["ө̆"]="ø̆", ["п"]="p",
	["Р"]="R", ["С"]="S", ["Ҫ"]="Ş", ["Т"]="T", ["Ҭ"]="Ț", ["Ԏ"]="Tj",["У"]="U",
	["р"]="r", ["с"]="s", ["ҫ"]="ş", ["т"]="t", ["ҭ"]="ț", ["ԏ"]="tj",["у"]="u",
	["Ӱ"]="Ü", ["Ў"]="Ŭ", ["Ф"]="F", ["Х"]="H", ["Ҳ"]="Ḥ", ["Ӽ"]="Ḥ", ["Ц"]="C",
	["ӱ"]="ü", ["ў"]="ŭ", ["ф"]="f", ["х"]="h", ["ҳ"]="ḥ", ["ӽ"]="ḥ", ["ц"]="c",
	["Ч"]="Č", ["Ҷ"]="Č̣", ["Ш"]="Š", ["Щ"]="Sj",["Ъ"]="”", ["Ы"]="Y", ["Ь"]="’",
	["ч"]="č", ["ҷ"]="č̣", ["ш"]="š", ["щ"]="sj",["ъ"]="”", ["ы"]="y", ["ь"]="’",
	["Э"]="E", ["Є"]="Ê", ["Є̈"]="Ë", ["Ю"]="Ju",["Ю̆"]="Jŭ",["Я"]="Ja",["Я̆"]="Jă", ["Я̈"]="Jä",
	["э"]="e", ["є"]="ê", ["є̈"]="ë", ["ю"]="ju",["ю̆"]="jŭ",["я"]="ja",["я̆"]="jă", ["я̈"]="jä",
};
 
function export.tr(text, lang, sc)
	return (mw.ustring.gsub(text, '.', tt))
end
 
return export