မော်ဂျူး:blk-translit
Documentation for this module may be created at မော်ဂျူး:blk-translit/doc
local export = {}
local gsub = mw.ustring.gsub
local u = mw.ustring.char
local letter_with_mark = '(.['..u(0x0300)..'-'..u(0x036F)..']?)'
local pre = {
['ျ'] = '္ယ', ['ြ'] = '္ရ', ['ွ'] = '္ဝ', ['ှ'] = '္ဟ',
}
local tt1 = {
-- consonants
['က'] = 'k', ['ခ'] = 'kh', ['ဂ'] = 'g', ['ဃ'] = 'gh', ['င'] = 'ṅ',
['စ'] = 'k', ['ဆ'] = 'ch', ['ဇ'] = 'j', ['ဈ'] = 'jh', ['ည'] = 'ñ',
['ဋ'] = 'ṭ', ['ဌ'] = 'ṭh', ['ဍ'] = 'ḍ', ['ဎ'] = 'ḍh', ['ၮ'] = 'ṇ', ["ဏ"] = 'ṇ',
['တ'] = 't', ['ထ'] = 'th', ['ဒ'] = 'd', ['ဓ'] = 'dh', ['န'] = 'n',
['ပ'] = 'p', ['င'] = 'ph', ['ဗ'] = 'b', ['ဘ'] = 'bh', ['မ'] = 'm',
['ယ'] = 'y', ['ရ'] = 'r', ['လ'] = 'l', ['ဝ'] = 'w', ['သ'] = 's',
['ဟ'] = 'h', ['ဠ'] = 'ḷ', ['အ'] = 'ʼ',
-- independent vowels (1)
['ဣ'] = 'i', ['ဤ'] = 'ī', ['ဥ'] = 'u', ['ဉ'] = 'u', ['ဦ'] = 'ū', ['ဩ'] = 'āo',
-- dependent vowels and diacritics (excluding front type)
['ါ'] = 'ā', ['ာ'] = 'ā', ['ိ'] = 'i', ['ီ'] = 'ī', ['ု'] = 'u', ['ူ'] = 'ū', ['ွ'] = 'w', ['ျ'] = 'y',
['ံ'] = 'ṁ', ['့'] = '.', ['း'] = 'ḥ', [''] = '́', ['ႏ'] = '́', ['ꩻ'] = '̀', [''] = '̀', ['္'] = '¡', ['်'] = 'o',
-- numerals
['၀'] = '0', ['၁'] = '1', ['၂'] = '2', ['၃'] = '3', ['၄'] = '4',
[''] = '0', [''] = '1', [''] = '2', [''] = '3', [''] = '4',
['၅'] = '5', ['၆'] = '6', ['၇'] = '7', ['၈'] = '8', ['၉'] = '9',
[''] = '5', [''] = '6', [''] = '7', [''] = '8', [''] = '9',
}
local adjust1 = {
-- dependent vowels (front type)
['ေ'] = 'ē', ['ဲ'] = 'ae', ['ော်'] = 'āo', ['ေ့'] = 'e', ['ဲ့'] = 'ea', ['ုဲင့်'] = 'ai', ['ဲုင်'] = 'āi', ['ော့'] = 'ao', ['ို့'] = 'o', ['ို'] = 'ō',
}
function export.tr(text, lang, sc, debug_mode)
if type(text) == 'table' then -- called directly from a template
text = text.args[1]
end
text = gsub(text, '.', pre)
text = gsub(text, '.', tt1)
for k, v in pairs(adjust1) do
text = gsub(text, letter_with_mark..k, v)
end
return text
end
return export