This module will transliterate text in the Burmese script. It is also used to transliterate Aiton and Phake.
The module should preferably not be called directly from templates or other modules.
To use it from a template, use {{xlit}}
.
Within a module, use Module:languages#Language:transliterate.
For testcases, see Module:aio-phk-translit/testcases.
tr(text, lang, sc)
text
written in the script specified by the code sc
, and language specified by the code lang
.nil
.local export = {}
local gsub = mw.ustring.gsub
local u = require("Module:string/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)
= "‼",
}
function export.tr(text, lang, sc)
if type(text) == "table" then -- called directly from a template
text = text.args
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