This module will transliterate text in the Avestan script. It is used to transliterate Avestan and Middle Persian.
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:Avst-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 mapping = {
= "a", -- AVESTAN LETTER A
= "ā", -- AVESTAN LETTER AA
= "å", -- AVESTAN LETTER AO
= "ā̊", -- AVESTAN LETTER AAO
= "ą", -- AVESTAN LETTER AN
= "ą̇", -- AVESTAN LETTER AAN
= "ə", -- AVESTAN LETTER AE
= "ə̄", -- AVESTAN LETTER AEE
= "e", -- AVESTAN LETTER E
= "ē", -- AVESTAN LETTER EE
= "o", -- AVESTAN LETTER O
= "ō", -- AVESTAN LETTER OO
= "i", -- AVESTAN LETTER I
= "ī", -- AVESTAN LETTER II
= "u", -- AVESTAN LETTER U
= "ū", -- AVESTAN LETTER UU
= "k", -- AVESTAN LETTER KE
= "x", -- AVESTAN LETTER XE
= "x́", -- AVESTAN LETTER XYE
= "xᵛ", -- AVESTAN LETTER XVE
= "g", -- AVESTAN LETTER GE
= "ġ", -- AVESTAN LETTER GGE
= "γ", -- AVESTAN LETTER GHE
= "c", -- AVESTAN LETTER CE
= "j", -- AVESTAN LETTER JE
= "t", -- AVESTAN LETTER TE
= "θ", -- AVESTAN LETTER THE
= "d", -- AVESTAN LETTER DE
= "δ", -- AVESTAN LETTER DHE
= "t̰", -- AVESTAN LETTER TTE
= "p", -- AVESTAN LETTER PE
= "f", -- AVESTAN LETTER FE
= "b", -- AVESTAN LETTER BE
= "β", -- AVESTAN LETTER BHE
= "ŋ", -- AVESTAN LETTER NGE
= "ŋ́", -- AVESTAN LETTER NGYE
= "ŋᵛ", -- AVESTAN LETTER NGVE
= "n", -- AVESTAN LETTER NE
= "ń", -- AVESTAN LETTER NYE
= "ṇ", -- AVESTAN LETTER NNE
= "m", -- AVESTAN LETTER ME
= "m̨", -- AVESTAN LETTER HME
= "ẏ", -- AVESTAN LETTER YYE
= "y", -- AVESTAN LETTER YE
= "v", -- AVESTAN LETTER VE
= "r", -- AVESTAN LETTER RE
= "l", -- AVESTAN LETTER LE
= "s", -- AVESTAN LETTER SE
= "z", -- AVESTAN LETTER ZE
= "š", -- AVESTAN LETTER SHE
= "ž", -- AVESTAN LETTER ZHE
= "š́", -- AVESTAN LETTER SHYE
= "ṣ̌", -- AVESTAN LETTER SSHE
= "h", -- AVESTAN LETTER HE
= " ", -- AVESTAN ABBREVIATION MARK
= "." -- WORD SEPARATOR MIDDLE DOT
}
function export.tr(text, lang, sc)
text = mw.ustring.gsub(text, "?", ".") -- punctuation
text = string.gsub(text, "*", mapping) -- transliterate letters
--text = mw.ustring.gsub(text, "ii", "y")
--text = mw.ustring.gsub(text, "uu", "v")
text = mw.ustring.gsub(text,"()rə()", "%1r<sup><small>ə</small></sup>%2") -- r > rə /V_C
text = mw.ustring.gsub(text,"()rə$", "%1r<sup><small>ə</small></sup>") -- r > rə /V_#
text = mw.ustring.gsub(text,"()i(rm)", "%1<sup><small>i</small></sup>%2") -- i-epenthesis
text = mw.ustring.gsub(text,"()i(ṇt)", "%1<sup><small>i</small></sup>%2") -- i-epenthesis
text = mw.ustring.gsub(text,"()i()", "%1<sup><small>i</small></sup>%2") -- i-epenthesis
text = mw.ustring.gsub(text,"(%.%s)i()", "%1<sup><small>i</small></sup>%2") -- i-epenthesis
text = mw.ustring.gsub(text,"^i()", "<sup><small>i</small></sup>%1") -- i-epenthesis
text = mw.ustring.gsub(text,"()u(r)", "%1<sup><small>u</small></sup>%2") -- u-epenthesis
return text
end
return export