မဝ်ဂျူ:kht-translit
မံက်ပြာကတ်
Documentation for this module may be created at မဝ်ဂျူ:kht-translit/doc
local export = {}
local gsub = mw.ustring.gsub
local u = mw.ustring.char
local tt1 = {
-- consonants
["က"] = "k", ["ၵ"] = "kh", ["ꩠ"] = "g", ["ၷ"] = "gh", ["င"] = "ng",
["ꩡ"] = "c", ["ꩢ"] = "ch", ["ꩣ"] = "j", ["ꩤ"] = "jh", ["ꩥ"] = "ny",
["ꩦ"] = "ṭ", ["ꩧ"] = "ṭh", ["ꩨ"] = "ḍ", ["ꩩ"] = "ḍh", ["ၼ"] = "ṇ",
["တ"] = "t", ["ထ"] = "th", ["ၻ"] = "d", ["ꩪ"] = "dh", ["ꩫ"] = "n",
["ပ"] = "p", ["ၸ"] = "ph", ["ၿ"] = "b", ["ၹ"] = "bh", ["မ"] = "m",
["ယ"] = "y", ["ꩳ"] = "r", ["ရ"] = "r", ["လ"] = "l", ["ဝ"] = "w",
["ꩬ"] = "s", ["ꩭ"] = "h", ["ꩮ"] = "ḷ", ["ꩯ"] = "f", ["ꩲ"] = "z",
["ꩱ"] = "x", ["ꩴ"] = "oay", ["ꩵ"] = "qn", ["ꩶ"] = "hm", ["ဢ"] = "ʼ",
-- medials
["ျ"] = "j", ["ြ"] = "r", ["ႂ"] = "ı", ["မ်"] = "m", ["ၼ်"] = "n", ["ၚ်"] = "ng", ["ပ်"] = "p", ["တ်"] = "t", ["ၵ်"]= "k", ["်"] = "l",
["ႇ"] = u(0x0300),
["ႈ"] = u(0x0304),
["း"] = u(0x0301),
["ႉ"] = u(0x0302) .. u(0x0330),
["ႊ"] = u(0x1DC8),
-- dependent vowels
["ႊ"] = "a", ["ၢ"] = "aa", ["ႃ"] = "ā", ["ိ"] = "i", ["ီ"] = "ī", ["ု"] = "u", ["ူ"] = "ū", ["ေ"] = "e",
["ဲ"] = "ai", ["ၢဲ"] = "aai", ["ဝ်"] = "au", ["်ွ"] = "au", ["ၢဝ်"] = "aau", ["ံ"] = "aṁ", ["ႄ"] = "ae", ["ႂ်"] = "ai",
["ေႃ"] = "aw", ["ွ"] = "aw", ["ိဝ်"] = "iu", ["ႅ"] = "ia", ["ႅဝ်"] = "iau", ["ျႃ"] = "iaa", ["ိူ"] = "oe", ["ႛ"] = "̂",
["ွဲ"] = "oi", ["ဴွ"] = "uai", ["ွႃ"] = "uaa", ["ေူ"] = "ui", ["ို"] = "ue", ["ိုဝ်"] = "uee", ["ုဝ်"] = "uo", ["ိုဝ်"] = "uea",
-- numerals
["႐"] = "0", ["႑"] = "1", ["႒"] = "2", ["႓"] = "3", ["႔"] = "4",
["႕"] = "5", ["႖"] = "6", ["႗"] = "7", ["႘"] = "8", ["႙"] = "9",
["၀"] = "0", ["၁"] = "1", ["၂"] = "2", ["၃"] = "3", ["၄"] = "4",
["၅"] = "5", ["၆"] = "6", ["၇"] = "7", ["၈"] = "8", ["၉"] = "9",
-- zero-width space (display it if it hides in a word)
[u(0x200B)] = "‼",
}
local adjust0 = {
-- tones
["မ်"] = "m", ["ၼ်"] = "n", ["ၚ်"] = "ng", ["ပ်"] = "p", ["တ်"] = "t", ["ၵ်"] = "k",
}
function export.tr(text, lang, sc, debug_mode)
if type(text) == "table" then -- called directly from a template
text = text.args[1]
end
for k, v in pairs(adjust0) do
text = gsub(text, k, v)
end
text = gsub(text, ".", tt1)
text = gsub(text, "əˣ", "")
text = gsub(text, "ə([aeiou])", "%1")
text = gsub(text, "ə", "a ")
text = gsub(text, "%s(["..u(0x0331)..u(0x0323)..u(0x0308)..u(0x0300)..u(0x0304).."])", "%1 ")
text = gsub(text, "(.-)%s*$", "%1") -- remove space at the end
return text
end
return export