This module will transliterate text in the Inscriptional Parthian script. It is used to transliterate Parthian.
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:Prti-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 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