Module:Altai-translit

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

This module will transliterate Southern Altai and Northern Altai text per WT:ALT TR and WT:ATV 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:Altai-translit/testcases.

Functions

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 tab = {
	="A", ="B", ="V", ="G", ="D", ="E", ="Yo", ="Ž", ="Z", ="I", ="Y", ="J̌", ="J̌]",
	="K", ="L", ="M", ="N", ="Ŋ", ="O", ="Ö", ="Ö]", ="P", ="R", ="S", ="T",
	="U", ="Ü", ="F", ="H", ="C", ="Č", ="Š", ="Šč", ="ʺ", ="Ï", ="ʹ",
	="E", ="Yu", ="Ya",
	='a', ='b', ='v', ='g', ='d', ='e', ='yo', ='ž', ='z', ='i', ='y', ="ǰ", ="ǰ]",
	='k', ='l', ='m', ='n', ='ŋ', ='o', ='ö', ='ö]', ='p', ='r', ='s', ='t',
	='u', ='ü', ='f',
	='h', ='c', ='č', ='š', ='šč', ='ʺ', ='ï', ='ʹ', ='e', ='yu', ='ya',
}

local iotated = {
	 = "Ye",
	 = "ye",
}

function export.tr(text, lang, sc)
	local ugsub = mw.ustring.gsub
	
	-- Ё needs to be composed if is decomposed (e + combining diaeresis).
	-- However, this cannot happen in wikitext, only in Lua modules.
	text = mw.ustring.toNFC(text)
	
	-- е after a vowel or at the beginning of a word becomes ye
	-- Note that according to modern Altai orthography ее (instead of ээ) is occationally used for long r
	text = ugsub(text, "(?)е", "%1ye")
	--text = mw.ustring.gsub(text, "(?)е", "%1ye")
	text = ugsub(text, "^", iotated)
	text = ugsub(text, "()()", function(a, b)
			return a .. iotated
		end)
	
	return (ugsub(text, '.', tab))
end
 
return export