মডিউল:ta-translit
অবয়ব
এই মডিউলের জন্য মডিউল:ta-translit/নথি-এ নথিপত্র তৈরি করা হয়ে থাকতে পারে
local export = {}
local consonants = {
['க']='ক' , ['ங']='ঙ' , ['ச']='চ' , ['ஞ']='ঞ' , ['ட']='ট' , ['ண']='ণ' , ['த']='ত' ,
['ந']='ন' , ['ப']='প', ['ம']='ম' , ['ய']='য়' , ['ர']='র' , ['ல']='ল' , ['வ']='ৱ' ,
['ழ']='ল়়' , ['ள']='ল়' , ['ற']='র়' , ['ன']='ন়' , ['ஶ']='শ' , ['ஜ']='জ' , ['ஷ']='ষ' ,
['ஸ']='স' , ['ஹ']='হ' , ['ஃப']='ফ়' , ['ஃஜ']='জ়' , ['ஃஸ']='ক্স', ['ஃக ']='খ়',
['ஃ']='ঃ' , ['ௐ']='ওঁ',
}
local diacritics = {
['ா']= 'া' , ['ி']='ি' , ['ீ']='ী' , ['ு']='ু' , ['ூ']='ূ' , ['ெ']='ে়' ,
['ே']='ে' , ['ை']='ৈ' , ['ொ']='ো়' , ['ோ']='ো' , ['ௌ']='ৌ' ,
['்']='্', --halant, suppresses the inherent vowel
-- no diacritic
[''] = 'া'
}
local nonconsonants = {
-- vowels
['அ']='অ' , ['ஆ']='আ' , ['இ']='ই' , ['ஈ']='ঈ' , ['உ']='উ' , ['ஊ']='ঊ' ,
['எ']='এ়' , ['ஏ']='এ' , ['ஐ']='ঐ' , ['ஒ']='ও়' , ['ஓ']='ও' , ['ஔ']='ঔ' ,
}
-- translit any words or phrases
function export.tr(text, lang, sc)
text = mw.ustring.gsub(
text,
'(ஃ?)([க-ஹ])([ா-்]?)',
function(h, c, d)
return (consonants[h..c] or consonants[h] .. (consonants[c] or c)) .. diacritics[d]
end)
text = mw.ustring.gsub(text, '[அ-ஔ]', nonconsonants)
text = mw.ustring.gsub(text, '^’', '')
text = mw.ustring.gsub(text, '([%s%p])’', '%1')
text = mw.ustring.gsub(text, 'ন়্', 'ন্')
text = mw.ustring.gsub(text, 'র়্', 'র্')
return text
end
return export