local mapping = {
["𐬀a"] = "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 KEAN
["𐬑"] = "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, "[\1-\127\194-\244][\128-\191]*", mapping) -- transliterate letters
--text = mw.ustring.gsub(text, "ii", "y")
--text = mw.ustring.gsub(text, "uu", "v")
["ə"] = "𐬆", -- AVESTAN LETTER AE
text = mw.ustring.gsub(text,"([aāəō])rə([kxgγcjtθδpfbβnmrlszšž])", "%1r<sup><small>ə</small></sup>%2") -- r > rə /V_C
text = mw.ustring.gsub(text,"([aāəō])rə$", "%1r<sup><small>ə</small></sup>") -- r > rə /V_#
["e"] = "𐬈", -- AVESTAN LETTER E
text = mw.ustring.gsub(text,"([aāeēəoōuū])i(rm[eiī])", "%1<sup><small>i</small></sup>%2") -- i-epenthesis
["ē"] = "𐬉", -- AVESTAN LETTER EE
text = mw.ustring.gsub(text,"([aāeēəoōuū])i(ṇt[eiī])", "%1<sup><small>i</small></sup>%2") -- i-epenthesis
["o"] = "𐬊", -- AVESTAN LETTER O
text = mw.ustring.gsub(text,"([aāeēəoōuū])i([kxgγtθδpfbβnrl][eiī])", "%1<sup><small>i</small></sup>%2") -- i-epenthesis
["ō"] = "𐬋", -- AVESTAN LETTER OO
text = mw.ustring.gsub(text,"(%.%s)i([θr][iī])", "%1<sup><small>i</small></sup>%2") -- i-epenthesis
["i"] = "𐬌", -- AVESTAN LETTER I
text = mw.ustring.gsub(text,"^i([θr][iī])", "<sup><small>i</small></sup>%1") -- i-epenthesis
["ī"] = "𐬍", -- AVESTAN LETTER II
["u"] = "𐬎", -- AVESTAN LETTER U
["ū"] = "𐬏", -- AVESTAN LETTER UU
["k"] = "𐬐", -- AVESTAN LETTER KE
text = mw.ustring.gsub(text,"([aāeēəiīoō])u(r[ouū])", "%1<sup><small>u</small></sup>%2") -- u-epenthesis
["x"] = "𐬑", -- AVESTAN LETTER XE
["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
["p"] = "𐬞", -- AVESTAN LETTER PE
["f"] = "𐬟", -- AVESTAN LETTER FE
["b"] = "𐬠", -- AVESTAN LETTER BE
["β"] = "𐬡", -- AVESTAN LETTER BHE
["ŋ"] = "𐬢", -- AVESTAN LETTER NGE
["n"] = "𐬥", -- AVESTAN LETTER NE
["ń"] = "𐬦", -- AVESTAN LETTER NYE
["ṇ"] = "𐬧", -- AVESTAN LETTER NNE
["m"] = "𐬨", -- AVESTAN LETTER ME
["ẏ"] = "𐬪", -- 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
["h"] = "𐬵", -- AVESTAN LETTER HE
["."] = "⸱", -- WORD SEPARATOR MIDDLE DOT
}
local two_char_mapping ={
["ā̊"] = "𐬃", -- AVESTAN LETTER AAO
["ą̇"] = "𐬅", -- AVESTAN LETTER AAN
["ə̄"] = "𐬇", -- AVESTAN LETTER AEE
["x́"] = "𐬒", -- AVESTAN LETTER XYE
["xᵛ"] = "𐬓", -- AVESTAN LETTER XVE
["t̰"] = "𐬝", -- AVESTAN LETTER TTE
["ŋ́"] = "𐬣", -- AVESTAN LETTER NGYE
["ŋᵛ"] = "𐬤", -- AVESTAN LETTER NGVE
["m̨"] = "𐬩", -- AVESTAN LETTER HME
["š́"] = "𐬳", -- AVESTAN LETTER SHYE
["ṣ̌"] = "𐬴", -- AVESTAN LETTER SSHE
}
function export.tr(text, lang, sc)
text = string.gsub(text, "..", two_char_mapping) -- transliterate letters
text = string.gsub(text, ".", mapping) -- transliterate letters
return text
end
|