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.
tr(text, lang, sc)
text
written in the script specified by the code sc
, and language specified by the code lang
.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