This module will transliterate Urak Lawoi' language text.
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:urk-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 urk = require("Module:urk-common")
local match = mw.ustring.match
local initials = {
= "k",
= "g",
= "kh",
= "ng",
= "c",
= "ch",
= "s",
= "ch", -- nonstandard spellling
= "ny",
= "d",
= "t",
= "th",
= "n",
= "b",
= "p",
= "ph",
= "f",
= "m",
= "y",
= "j",
= "r",
= "l",
= "w",
= "ʼ",
= "h"
}
local medials = {
= "r",
= "l"
}
local vowels = {
= "ö",
= "ë",
= "aw",
= "e",
= "e",
= "ia",
= "ä",
= "o",
= "a",
= "ua",
= "a",
= "i",
= "i",
= "e", -- nonstandard spelling
= "e",
= "u",
= "u"
}
local finals = {
= "k",
= "ng",
= "c", -- alterative spelling
= "t",
= "n",
= "p",
= "m",
= "y",
= "c",
= "s",
= "l", -- variable pronunciation
= "l", -- only in phuket
= "w",
= "h",
= "q",
= "h" -- alterative spelling
}
-- main function
function export.tr(text, lang, sc)
local translit = ""
local respelt = urk.syllabise(text, true)
for _, segment in ipairs(respelt) do
if match(segment, "") then
local v_pref, i, m, v_suf, f_pref, f_suf = match(segment, urk.syllable_pattern)
local v = v_pref .. v_suf
-- special case for "เีย"
if v_pref == "เ" and v_suf == "ี" and f_pref == "ย" then
v = "เีย"
f_pref = ""
end
local f = f_pref .. f_suf
-- join components together
translit = translit .. (initials or "") .. (medials or "") .. (vowels or "") .. (finals or "")
else
translit = translit .. segment
end
end
return translit
end
return export