Module:os-translit

Hello, you have come here looking for the meaning of the word Module:os-translit. In DICTIOUS you will not only get to know all the dictionary meanings for the word Module:os-translit, but we will also tell you about its etymology, its characteristics and you will know how to say Module:os-translit in singular and plural. Everything you need to know about the word Module:os-translit you have here. The definition of the word Module:os-translit will help you to be more precise and correct when speaking or writing your texts. Knowing the definition ofModule:os-translit, as well as those of other words, enriches your vocabulary and provides you with more and better linguistic resources.

This module will transliterate Ossetian language text per WT:OS 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:os-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 mapping1 = {
	="æ" ,='Æ' , ="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',
	="ḱ" ,='Ḱ' , ="šč",='ŠČ', ="ja",='Ja', ="y",='Y', ="è",='È',
	="m" ,='M' , ="o" ,='O' , ="i" ,='I' , ="ë",='Ë', ="ž",='Ž',
	="k" ,='K' , ="d" ,='D' , ="v" ,='V' , ="c",='C', ="a",='A'
}

local mapping2 = {
	 = 'k’',  = 'K’',  = 'p’',  = 'P’',
	 = 't’',  = 'T’',  = 'c’',  = 'C’',
	 = 'ḱ’',  = 'Ḱ’',  = 'q' ,  = 'Q',
	 = 'ǧ' ,  = 'Ǧ' ,  = 'ǵ' ,  = 'Ǵ',
	 = 'ʒ' ,  = 'Ʒ' ,  = 'aw',  = 'Aw',
	 = 'æw',  = 'Æw',  = 'iw',  = 'Iw',
	 = 'yw',  = 'Yw',  = 'ew',  = 'Ew',
	 = 'wa',  = 'Wa',  = 'wæ',  = 'Wæ',
	 = 'wi',  = 'Wi',  = 'wy',  = 'Wy',
	 = 'we',  = 'We',
}

local mapping3 = {
	 = 'g°y',  = 'G°y',
	 = 'k°y',  = 'K°y',
	 = 'x°y',  = 'X°y',
}

function export.tr(text, lang, sc)
	if sc ~= "Cyrl" then return nil end
	
	text = mw.ustring.gsub(text, 'къуы', 'k’°y')
	text = mw.ustring.gsub(text, 'Kъуы', 'K’°y')
	for pat, repl in pairs(mapping3) do
		text = mw.ustring.gsub(text, pat, repl)
	end
	for pat, repl in pairs(mapping2) do
		text = mw.ustring.gsub(text, pat, repl)
	end
	text = mw.ustring.gsub(text, '.', mapping1)

	return text
end

return export