Modul:Modi-translit
Dokumentasi untuk modul ini dapat dibuat di Modul:Modi-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',
['๐ง']='y', ['๐จ']='r', ['๐ฉ']='l', ['๐ช']='v', ['๐ฏ']='แธท',
['๐ซ']='ล', ['๐ฌ']='แนฃ', ['๐ญ']='s', ['๐ฎ']='h',
}
local diacritics = {
['๐ฐ']='ฤ', ['๐ฑ']='i', ['๐ฒ']='ฤซ', ['๐ณ']='u', ['๐ด']='ลซ', ['๐ต']='แน', ['๐ถ']='แน',
['๐ท']='แธท', ['๐ธ']='แธน', ['๐น']='e', ['๐บ']='ai', ['๐ป']='o', ['๐ผ']='au',
-- virama
['๐ฟ'] = '',
}
local tt = {
-- vowel signs
['๐'] = 'a', ['๐'] = 'i', ['๐'] = 'u', ['๐'] = 'e', ['๐'] = 'o',
['๐'] = 'ฤ', ['๐'] = 'ฤซ', ['๐
'] = 'ลซ',
['๐'] = 'ล',
['๐'] = 'ai', ['๐'] = 'au',
['๐๐'] = 'ล',
['๐๐'] = 'ฤ', ['๐๐'] = 'ฤ',
-- anusvara
['๐ฝ'] = 'แน',
-- visarga
['๐พ'] = 'แธฅ',
-- numerals
['๐'] = '0', ['๐'] = '1', ['๐'] = '2', ['๐'] = '3', ['๐'] = '4', ['๐'] = '5', ['๐'] = '6', ['๐'] = '7', ['๐'] = '8', ['๐'] = '9',
--punctuation
['๐'] = '.', -- danda
['๐'] = '.', -- double danda
['+'] = '', -- compound separator
-- abbreviation sign
['๐'] = '.',
--Om
['เฅ']='oแน',
}
function export.tr(text, lang, sc)
text = mw.ustring.gsub(
text,
'([๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐ ๐ก๐ข๐ฃ๐ค๐ฅ๐ฆ๐ง๐จ๐ฉ๐ช๐ฏ๐ซ๐ฌ๐ญ๐ฎ])'..
'([๐ฐ๐ฑ๐ฒ๐ณ๐ด๐ต๐ถ๐ท๐ธ๐น๐บ๐ป๐ผ๐ฟ]?)',
function(c, d)
if d == "" then
return consonants[c] .. 'a'
else
return consonants[c] .. diacritics[d]
end
end)
text = mw.ustring.gsub(text, '.[๐]?', tt)
return text
end
return export