This module will transliterate text in the Tai Viet script.
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:Tavt-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 tt = {
-- consonants
= "k", = "ḵ", = "k̄h", = "kh", = "ḳ̄h", = "kʹh", = "?", = "?", = "h̄ng", = "ng",
= "c", = "c̱", = "c̄h", = "ch", = "s̄", = "s", = "h̄ỵ", = "ỵ",
= "d", = "ḏ", = "t", = "ṯ", = "t̄h", = "th", = "h̄n", = "n",
= "b", = "ḇ", = "p", = "p̱", = "p̄h", = "ph", = "f̄", = "f", = "h̄m", = "m",
= "h̄y", = "y", = "h̄r", = "r", = "h̄l", = "l", = "h̄w", = "w",
= "h̄", = "ḥ", = "x", = "x̱",
-- vowels and finals (visual ordering)
= "'", = "ā", = "l", = "ụ", = "ุ", = "æ", = "o",
= "'", = "y", = "e", = "ัw", = "i", = "ị",
= "ัn", = "ả",
-- tones
= "'", = "<sup>1</sup>", = "'", = "<sup>2</sup>",
-- symbols
= "ko̱n", = "nụ̀ng", = "«", = "§", = "»",
}
function export.tr(text, lang, sc)
if type(text) == "table" then -- called directly from a template
text = text.args
end
text = gsub(text, ".", tt)
text = gsub(text, "()()", "%2%1")
text = gsub(text, "()bả", "%1ัb")
text = gsub(text, "(ả)()", "%2%1")
return text
end
return export