Module:ta-translit

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

This module will transliterate Tamil language text. It is also used to transliterate Irula, Kota (India), Mannan, and Betta Kurumba. 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:ta-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 consonants = {
	='k' , ='ṅ' , ='c' , ='ñ' , ='ṭ' , ='ṇ' , ='t' ,
	='n' , ='p', ='m' , ='y' , ='r' , ='l' , ='v' ,
	='ḻ' , ='ḷ' , ='ṟ' , ='ṉ' , ='ś' , ='j' , ='ṣ' , 
	='s' , ='h' , ='f' , ='z', ='ks' , ='x',
	='ḥ' , ='о̄m',
}

local diacritics = {
	= 'ā' , ='i' , ='ī' , ='u' , ='ū' ,  ='e' ,
	='ē' , ='ai' , ='o' , ='ō' , ='au', 
	='',	--halant, supresses the inherent vowel "a"
	-- no diacritic
	 = 'a',
}

local nonconsonants = {
	-- vowels
	='’a' , ='’ā' , ='’i' , ='’ī' , ='’u' , ='’ū' , 
	='’e' , ='’ē' , ='’ai' , ='’o' , ='’ō' , ='’au' , ='о̄m',
	-- other symbols
--	='' , ='о̄m',
}

-- translit any words or phrases
function export.tr(text, lang, sc)
	text = mw.ustring.gsub(
		text,
		'(ஃ?)()(?)',
		function(h, c, d)
			return (consonants or consonants .. (consonants or c)) .. diacritics
		end)
	
	text = mw.ustring.gsub(text, '', nonconsonants)

	text = mw.ustring.gsub(text, '^’', '')
	text = mw.ustring.gsub(text, '()’', '%1')
	
	return text
end
 
return export