local export = {}
local tt = {
= "ʾ", -- aleph
= "b", -- beth
= "g", -- gimil
= "d", -- daleth
= "h", -- he
= "ʿ", -- waw-ayin-resh
= "z", -- zayin
= "ḥ", -- heth
= "ṭ", -- teth
= "y", -- yodh
= "k", -- kaph
= "l", -- lamedh
= "m", -- mem-qoph
= "n", -- nun
= "s", -- samekh
= "p", -- pe
= "c", -- sadhe
= "š", -- shin
= "t", -- taw
}
local numbers = {
= 1,
= 2,
= 3,
= 4,
= 10,
= 20,
= 100,
= 1000,
}
function export.convert_numbers(numeric_str)
local total = 0
for c in mw.ustring.gmatch(numeric_str, ".") do
total = total + numbers
end
return total
end
function export.tr(text, lang, sc)
-- If the script is not Phli, do not transliterate
if sc ~= "Phli" then
return
end
-- Category to catch automatic transcriptions of waw-ayin-resh and mem-qoph
-- ]
local ambig_note = ""
if mw.ustring.match(text, "") then
ambig_note = "]"
end
if mw.ustring.match(text, "") then
text = mw.ustring.gsub(text, "+", export.convert_numbers)
end
-- Transliterate characters
text = mw.ustring.gsub(text, ".", tt)
return text .. ambig_note
end
return export