local export = {}
local tt = {
= 'ʾ',
= 'b',
= 'g',
= 'd',
= 'h',
= 'w',
= 'z',
= 'ḥ',
= 'ṭ',
= 'y',
= 'k',
= 'l',
= 'm',
= 'n',
= 's',
= 'ʿ',
= 'p',
= 'c',
= 'q',
= 'r',
= 'š',
= 't',
}
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 Prti, do not transliterate
if sc ~= "Prti" then
return
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
end
return export