local export = {}
local conv = {
='ô', ='t', ='g', ='ṅ', ='l',
='a', ='k', ='j', ='m', ='v',
='i', ='s', ='h', ='ñ', ='r',
='u', ='c', ='d', ='ṇ', ='y',
='e', ='p', ='ḍ', ='n', ='ṛ',
='o', ='ṭ', ='b', ='w̃',
='h', -- aspiration
-- numerals
='0', ='1', ='2', ='3', ='4', ='5', ='6', ='7', ='8', ='9',
-- punctuation
='.',
='.',
-- special chars
='̃', -- mu tudag: nasalization
='ᱹ̃', -- mu gahla tudag: nasalization
='ː' -- rela: gemination
}
local gahla_tudag = {
='ŏ', ='ă', ='ĕ',
}
local ahad = {
='g', ='j', ='d', ='b', ='h'
}
local pharka = {
='k’', ='c’', ='t’', ='p’', ='h’'
}
local punctuation = '()'
function export.tr(text, lang, sc)
text = mw.ustring.gsub(
text,
".",
function(c)
return conv
end)
-- word-final glottalization
text = mw.ustring.gsub(text, '$', pharka)
text = mw.ustring.gsub(
text,
'()' .. punctuation,
function(c, d)
return pharka .. d
end)
-- gahla tudag
text = mw.ustring.gsub(
text,
'(.)ᱹ',
function(c)
return gahla_tudag
end
)
-- ahad
text = mw.ustring.gsub(
text,
'(.’)ᱽ',
function(c)
return ahad
end
)
-- parkha
text = mw.ustring.gsub(
text,
'(.)ᱼ',
function(c)
return pharka
end
)
text = mw.ustring.gsub(text, 'h’', 'ʔ')
return text
end
return export