Module:Ahom-translit
- De neikommende dokumintaasje stiet op Module:Ahom-translit/dokumintaasje. [bewurkje]
Oernommen fan en:Module:Ahom-translit.
local export = {}
local gsub = mw.ustring.gsub
local u = mw.ustring.char
local con_cls = "([๐-๐๐-๐][๐".."๐".."๐]?)"
-- see also https://www.unicode.org/L2/L2020/20258-add-tai-ahom.pdf
-- ๐ represents both j and y
local tt = {
-- consonants
["๐"] = "k", ["๐"] = "kh", ["๐"] = "แน
", ["๐"] = "n", ["๐"] = "t", ["๐
"] = "t",
["๐"] = "p", ["๐"] = "ph", ["๐"] = "b", ["๐"] = "m", ["๐"] = "jสธ", ["๐"] = "ch",
["๐"] = "th", ["๐"] = "r", ["๐"] = "l", ["๐"] = "s", ["๐"] = "รฑ", ["๐"] = "h",
["๐"] = "สผ", ["๐"] = "d", ["๐"] = "dh", ["๐"] = "g", ["๐"] = "g", ["๐"] = "gh",
["๐"] = "bh", ["๐"] = "jh", ["๐"] = "v",
["๐"] = "c", ["๐"] = "แนญ", ["๐"] = "แนญh", ["๐"] = "แธ", ["๐"] = "แธh", ["๐
"] = "แน", ["๐"] = "แธท",
-- medials
["๐"] = "l", ["๐"] = "r", ["๐"] = "r",
-- vowels (excluding composition)
["๐ "] = "a", ["๐ก"] = "ฤ", ["๐ข"] = "i", ["๐ฃ"] = "ฤซ",
["๐ค"] = "u", ["๐ฅ"] = "ลซ", ["๐ง"] = "w", ["๐ฉ"] = "y",
["๐ฆ"] = "e", ["๐จ"] = "o",
["๐ช"] = "แน", ["๐ซ"] = "",
-- numerals
["๐ฐ"] = "0", ["๐ฑ"] = "1", ["๐ฒ"] = "2", ["๐ณ"] = "3", ["๐ด"] = "4",
["๐ต"] = "5", ["๐ถ"] = "6", ["๐ท"] = "7", ["๐ธ"] = "8", ["๐น"] = "9",
["๐บ"] = "[10]", ["๐ป"] = "[20]",
-- punctuations and symbols
["๐ผ"] = ",", ["๐ฝ"] = ".", ["๐พ"] = "@", ["๐ฟ"] = "vi",
-- zero-width space (display it if it hides in a word)
[u(0x200B)] = "โผ",
}
local adjust0 = {
-- vowels (composition)
["๐ข".."๐ค"] = "รผ",
["๐ฆ".."๐ก"] = "ล",
["๐จ".."๐ฆ".."๐ก"] = "wล",
["๐ฆ".."๐ง"] = "ฤ",
["๐ฉ".."๐ค"] = "ฤy",
["๐ง".."๐ค"] = "ฤw",
}
function export.tr(text, lang, sc, debug_mode)
if type(text) == "table" then -- called directly from a template
text = text.args[1]
end
text = gsub(text, "[๐๐](๐ซ)", "w%1") -- final -b (or -v) becomes -w
text = gsub(text, con_cls.."([๐-๐๐-๐w])๐ซ", "%1a%2")
text = gsub(text, con_cls.."([๐ง".."๐ฉ".."๐ช])", "%1a%2")
for k, v in pairs(adjust0) do
text = gsub(text, con_cls..k, "%1"..v)
end
text = gsub(text, ".", tt)
return text
end
return export