local export = {}
local consonants = {
= 'k', = 'kh', = 'g', = 'ṅ',
= 'c', = 'ch', = 'j', = 'ñ',
= 'ṭ', = 'ṭh', = 'ḍ', = 'ṇ',
= 't', = 'th', = 'd', = 'n',
= 'p', = 'ph', = 'b', = 'm',
= 'y', = 'r', = 'l', = 'w',
= 'ś', = 'ṣ', = 's', = 'h',
= 'ċ', = 'ċh', = 'z',='f',
= 'q', = 'x', = 'ġ',
= 'bh', --found ocassionally in some Sanskrit loanwords
}
local diacritics = {
= 'ā', = 'ạ', = 'ạ̄', = 'ụ', = 'ụ̄', = 'i', = 'ī', = 'u', = 'ū', = 'ṛ',
= 'e', = 'ē', = 'ai', = 'o', = 'ō', = 'ô', = 'au', = '', = 'ạ', ='ạ̄'
}
local tt = {
-- vowels
= 'a', = 'ā', = 'ạ', = 'ạ̄', = 'ụ', = 'ụ̄', = 'i', = 'ī', = 'u', = 'ū', = 'ṛ',
= 'e', = 'ē', = 'ai', = 'o', = 'ō', = 'ô', = 'au', = 'ạ', = 'ạ̄',
--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
= '.', --danda
= '.', --double danda
= 'om',
}
function export.tr(text, lang, sc)
text = mw.ustring.gsub(text, '(.?.?)$', '%1्')
text = mw.ustring.gsub(text,
'(़?)' .. --tbd later
'(?)',
function(c, d)
if d == "" then
return consonants .. 'a'
else
return consonants .. diacritics
end
end)
text = mw.ustring.gsub(text, '.', tt)
text = mw.ustring.gsub(text, '्$', '')
return text
end
return export