Module:Ahom-translit
Jump to navigation
Jump to search
Documentation for this module may be created at Module:Ahom-translit/doc
local export = {}
local gsub = mw.ustring.gsub
local u = require("Module:string/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)
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