This module will transliterate Written Oirat language text. It is also used to transliterate Classical Tibetan.
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:xwo-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 MACRON = mw.ustring.char(0x0304)
local tt = {
= "a", = "e", = "i", = "o", = "u",
= "ö", = "ü",
= "b", = "p", = "m", = "l",
= "s", = "š", = "n", = "x",
= "ɣ", = "t", = "d", = "c",
= "č", = "ǰ", = "y", = "r",
= "w", = "h", = "gh", = "q",
= "ž", = "ń", = "dz", = "ng",
= "z",
= MACRON, = "-", = "?", = "!",
= ",", = ".", = "-", = "-"
}
function export.tr(text, lang, sc)
local velar_conv = { = "k", = "g" }
text = mw.ustring.gsub(text, ".", tt)
text = mw.ustring.gsub(text, "()(.?)", function(velar, vowel)
return ((mw.ustring.match(vowel, "") or vowel == "")
and mw.ustring.gsub(velar, "", velar_conv) or velar) .. vowel end)
text = mw.ustring.gsub(text, "zi", "ji")
return text
end
return export