মডিউল:aio-phk-translit
অবয়ব
এই মডিউলের জন্য মডিউল:aio-phk-translit/নথি-এ নথিপত্র তৈরি করা হয়ে থাকতে পারে
local export = {}
local gsub = mw.ustring.gsub
local u = mw.ustring.char
local con_cls = "([ကၵငꩡꩬၺတထꩫဒပၸမဗယꩺလဝꩭဢ])"
local med_cls = "([ျြၞ]?)"
local tt1 = {
-- consonants
["က"] = "k", ["ၵ"] = "kh", ["င"] = "ṅ",
["ꩡ"] = "c", ["ꩬ"] = "s", ["ၺ"] = "ñ",
["တ"] = "t", ["ထ"] = "th", ["ꩫ"] = "n", ["ဒ"] = "d",
["ပ"] = "p", ["ၸ"] = "ph", ["မ"] = "m", ["ဗ"] = "b",
["ယ"] = "y", ["ꩺ"] = "r", ["လ"] = "l", ["ဝ"] = "w",
["ꩭ"] = "h", ["ဢ"] = "ʼ",
-- medials
["ျ"] = "y", ["ြ"] = "r", ["ၞ"] = "w",
-- dependent vowels and diacritics (excluding front type)
["္"] = "", ["ႜ"] = "a", ["ႃ"] = "ā", ["ိ"] = "i", ["ီ"] = "ī",
["ု"] = "u", ["ူ"] = "ū", ["ွ"] = "o", ["်"] = "", ["ႝ"] = "y",
["ေ"] = "e", ["ံ"] = "ṃ",
-- 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, "ွ".."်", "aw")
text = gsub(text, "ၞ".."်", "aü")
text = gsub(text, con_cls .. med_cls .. con_cls .. "်", "%1%2a%3")
text = gsub(text, con_cls .. med_cls .. "([ႝံ])", "%1%2a%3")
text = gsub(text, ".", tt1)
return text
end
return export