Module:Mahj-translit
Documentation for this module may be created at Module:Mahj-translit/doc
local export = {}
local consonants = {
['๐
']='k', ['๐
']='kh', ['๐
']='g', ['๐
']='gh',
['๐
']='c', ['๐
']='ch', ['๐
']='j', ['๐
']='jh', ['๐
']='รฑ',
['๐
']='แนญ', ['๐
']='แนญh', ['๐
']='แธ', ['๐
ก']='แธh', ['๐
ข']='แน',
['๐
ฃ']='t', ['๐
ค']='th', ['๐
ฅ']='d', ['๐
ฆ']='dh', ['๐
ง']='n',
['๐
จ']='p', ['๐
ฉ']='ph', ['๐
ช']='b', ['๐
ซ']='bh', ['๐
ฌ']='m',
['๐
ญ']='r', ['๐
ฎ']='l', ['๐
ฏ']='v',
['๐
ฐ']='s', ['๐
ฑ']='h', ['๐
ฒ'] = 'แน',
}
local nonconsonants = {
-- vowels
['๐
']='a', ['๐
']='i', ['๐
']='u', ['๐
']='e', ['๐
']='o',
-- other symbols
['๐
ดโ']='.', -- abbreviation mark
['๐
ต']='ยง', -- section mark
['๐
ถ']='Shri', -- ligature [[เคถเฅเคฐเฅ]]
}
-- translit any words or phrases
function export.tr(text, lang, sc)
text = mw.ustring.gsub(
text,
'([๐
๐
๐
๐
๐
๐
๐
๐
๐
๐
๐
๐
๐
ก๐
ข๐
ฃ๐
ค๐
ฅ๐
ฆ๐
ง๐
จ๐
ฉ๐
ช๐
ซ๐
ฌ๐
ญ๐
ฎ๐
ฏ๐
ฐ๐
ฑ๐
ฒ])'..
'([๐
ณ]?)',
function(c, d)
-- mw.log('match', c, d)
return (consonants[c] or c)
end)
text = mw.ustring.gsub(text, '.', nonconsonants)
return text
end
return export