Mô đun:sa-Telu-translit
Giao diện
local gsub = mw.ustring.gsub
local export = {}
local consonants = {
['క']='k', ['ఖ']='kh', ['గ']='g', ['ఘ']='gh', ['ఙ']='ṅ',
['చ']='c', ['ఛ']='ch', ['జ']='j', ['ఝ']='jh', ['ఞ']='ñ',
['ట']='ṭ', ['ఠ']='ṭh', ['డ']='ḍ', ['ఢ']='ḍh', ['ణ']='ṇ',
['త']='t', ['థ']='th', ['ద']='d', ['ధ']='dh', ['న']='n',
['ప']='p', ['ఫ']='ph', ['బ']='b', ['భ']='bh', ['మ']='m',
['య']='y', ['ర']='r', ['ల']='l', ['వ']='v', ['ళ']='ḷ',
['శ']='ś', ['ష']='ṣ', ['స']='s', ['హ']='h',
}
local diacritics = {
['ా']='ā', ['ి']='i', ['ీ']='ī', ['ు']='u', ['ూ']='ū', ['ృ']='ṛ', ['ౄ']='ṝ',
['ౢ']='ḷ', ['ౣ']='ḹ', ['ే']='e', ['ై']='ai', ['ో']='o', ['ౌ']='au', ['్']='',
}
local tt = {
-- vowels
['అ']='a', ['ఆ']='ā', ['ఇ']='i', ['ఈ']='ī', ['ఉ']='u', ['ఊ']='ū', ['ఋ']='ṛ', ['ౠ']='ṝ',
['ఌ']='ḷ', ['ౡ']='ḹ', ['ఏ']='e', ['ఐ']='ai', ['ఓ']='o', ['ఔ']='au',
-- Nakaara Pollu
['ౝ']='n',
-- chandrabindu
['ఁ']='m̐', --until a better method is found
-- anusvara
['ం']='ṃ', --until a better method is found
-- visarga
['ః']='ḥ',
-- avagraha
['ఽ']='’',
--numerals
['౦']='0', ['౧']='1', ['౨']='2', ['౩']='3', ['౪']='4', ['౫']='5', ['౬']='6', ['౭']='7', ['౮']='8', ['౯']='9',
--punctuation
['॥']='.', --double danda
['।']='.', --danda
--Vedic extensions
-- ["ᳵ"] = "ᳵ", ["ᳶ"] = "ᳶ",
--Om
['ఓం']='oṃ',
--reconstructed
['*'] = '',
}
function export.tr(text, lang, sc)
text = gsub(
text,
'([కఖగఘఙచఛజఝఞటఠడఢణతథదధనపఫబభమయరలవళశషసహ])'..
'([ాిీుూృౄౢౣేైోౌ్]?)',
function(c, d)
if d == "" then
return consonants[c] .. 'a'
else
return consonants[c] .. diacritics[d]
end
end)
text = gsub(text, '.', tt)
return text
end
return export