Jump to content

Module:oaa-translit

From Wiktionary, the free dictionary

This module will transliterate Orok 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:oaa-translit/testcases.

Functions

[edit]
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 single_letter_replacements = {

	["А"]='A', ["а"]='a',
	["Б"]='B', ["б"]='b',
	["В"]='V', ["в"]='v',
	["Е"]='E', ["е"]='e',
	["Ё"]='Jo', ["ё"]='jo',
	["Г"]='G', ["г"]='g',
	["Д"]='D', ["д"]='d',
	["Ӡ"]='Ʒ', ["ӡ"]='ʒ',
	["И"]='I', ["и"]='i',
	["Ӣ"]='Ī', ["ӣ"]='ī',
	["Й"]='J', ["й"]='j',
	["К"]='K', ["к"]='k',
	["Л"]='L', ["л"]='l',
	["М"]='M', ["м"]='m',
	["Н"]='N', ["н"]='n',
	["Ӈ"]='Ŋ', ["ӈ"]='ŋ',
	["Ԩ"]='Ń', ["ԩ"]='ń',
	["О"]='O', ["о"]='o',
	["Ө"]='Ö', ["ө"]='ö',
	["П"]='P', ["п"]='p',
	["Р"]='R', ["р"]='r',
	["С"]='S', ["с"]='s',
	["Т"]='T', ["т"]='t',
	["У"]='U', ["у"]='u',
	["Ӯ"]='Ū', ["ӯ"]='ū',
	["Х"]='H', ["х"]='h', 
	["Ч"]='Č', ["ч"]='č',
	["Ы"]='Y', ["ы"]='y',
	["Э"]='Ə', ["э"]='ə',
	["Ю"]='Ju', ["ю"]='ju',
	["Я"]='Ja', ["я"]='ja',
	['Ъ']='ʺ', ['ъ']='ʺ',

	-- NOT PRESENT IN THE ORIGINAL LATINISATION --

	-- non-native letters
	["Ж"]='Ž', ["ж"]='ž',
	["З"]='Z', ["з"]='z',
	["Ц"]='C', ["ц"]='c',
	["Ш"]='Š', ["ш"]='š',
	["Щ"]='Šč', ["щ"]='šč',
	["Ь"]="’", ["ь"]="’",
	["Ф"]='F', ["ф"]='f',
	
	-- non-standard letters
	["Ҥ"]='Ŋ', ["ҥ"]='ŋ',

}

function export.tr(text, lang, sc)
	return (mw.ustring.gsub(text, ".", single_letter_replacements))
end

return export