local export = {}
local gsub = mw.ustring.gsub
local u = mw.ustring.char
local con_cls = "([ကၵငꩡꩬၺတထꩫဒပၸမဗယꩺလဝꩭဢ])"
local med_cls = "([ျြၞ]?)"
local tt1 = {
-- consonants
["က"] = "ก", ["ၵ"] = "ข", ["င"] = "ง",
["ꩡ"] = "จ", ["ꩬ"] = "ส", ["ၺ"] = "ญ",
["တ"] = "ต", ["ထ"] = "ถ", ["ꩫ"] = "น", ["ဒ"] = "ด",
["ပ"] = "ป", ["ၸ"] = "ผ", ["မ"] = "ม", ["ဗ"] = "บ",
["ယ"] = "ย", ["ꩺ"] = "ร", ["လ"] = "ล", ["ဝ"] = "ว",
["ꩭ"] = "ห", ["ဢ"] = "อ",
-- medials
["ျ"] = "ฺย", ["ြ"] = "ฺร", ["ၞ"] = "ฺว",
-- dependent vowels and diacritics (excluding front type)
["္"] = "ฺ", ["ႜ"] = "ะ", ["ႃ"] = "า", ["ိ"] = "ิ", ["ီ"] = "ี",
["ု"] = "ุ", ["ူ"] = "ู", ["ွ"] = "อ̂", ["်"] = "์", ["ႝ"] = "ย์",
["ေ"] = "↶เ", ["ံ"] = "ํ",
-- punctuation marks
["၊"] = ",", ["။"] = ".", ["꩷"] = "!",
-- numerals
["꩸"] = "1", ["꩹"] = "2",
["၀"] = "0", ["၁"] = "1", ["၂"] = "2", ["၃"] = "3", ["၄"] = "4",
["၅"] = "5", ["၆"] = "6", ["၇"] = "7", ["၈"] = "8", ["၉"] = "9",
-- zero-width space (display it if it hides in a word)
[u(0x200B)] = "‼",
}
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, u(0xFE00), "") -- remove VS01
text = gsub(text, "ေ".."ႃ", "อ̂")
text = gsub(text, "ိ".."ု", "ึ")
text = gsub(text, "ွ".."်", "↶เา")
text = gsub(text, "ၞ".."်", "↶ใ")
text = gsub(text, ".", tt1)
text = gsub(text, "([ก-ฮ]์)([่้๊๋๎])", "%2%1")
text = gsub(text, "(อ̂)([่้๊๋๎])", "%2%1")
text = gsub(text, "(า)([่้๊๋๎])", "%2%1")
text = gsub(text, "(.)↶([เแใไ])", "%2%1")
return text
end
return export