local export = {}
-- local symbols= {
-- used to map more than one letter
-- ="ﻻ",
-- ="ﷲ",
-- }
local mapping = {
='â', ='b', ='p', ='t', ='s', ='j', ='č', ='h', ='x',
='d', ='z', ='r', ='z', ='ž', ='s', ='š', ='s', ='z',
='t', ='z', ='ğ', ='f', ='q', ='k', ='g', ='l',
='m', ='n', ='o', ='h', ='e', ='â',
-- displaying on separate lines as the viewing becomes distorted on these combinations
="’",
="’",
="’",
="’",
="’",
-- diacritics
="a", -- fathe, zabar
="i", -- kasre, zir
="u", -- zamme, piš
="", -- jazm, sokun - no vowel
="-", -- ZWNJ (zero-width non-joiner)
-- ligatures
="lâ",
="llâh",
-- kashida
="", -- kashida, no sound
-- numerals
="1", ="2", ="3", ="4", ="5",
="6", ="7", ="8", ="9", ="0",
-- normal arabic variants to numerals
="1", ="2", ="3", ="4", ="5",
="6", ="7", ="8", ="9", ="0",
-- punctuation (leave on separate lines)
="?", -- question mark
=",", -- comma
=";", -- semicolon
='“', -- quotation mark
='”', -- quotation mark
="%", -- percent
="‰", -- per mille
=".", -- decimal point
=",", -- thousands separator
="-ye" -- he ye (in ezâfe)
};
function export.track(text, lang, sc)
if type(text) == "table" then
text, lang, sc = text.args, text.args, text.args
end
text = mw.ustring.gsub(text, 'ه$', "\217\144")
text = mw.ustring.gsub(text, 'ه()', "\217\144")
text = mw.ustring.gsub(text, 'ىٰ', "â")
text = mw.ustring.gsub(text, '.', mapping)
text = mw.ustring.gsub(text, 'âً', "an")
text = mw.ustring.gsub(text, 'aâ', "â")
text = mw.ustring.gsub(text, 'âa', "a")
text = mw.ustring.gsub(text, 'ie', "î")
text = mw.ustring.gsub(text, 'ae', "ay")
text = mw.ustring.gsub(text, 'uo', "û")
text = mw.ustring.gsub(text, 'ao', "au")
-- text = mw.ustring.gsub(text, 'o()', "v%1")
-- text = mw.ustring.gsub(text, 'e()', "y%1")
text = mw.ustring.gsub(text, "()(\217\145)", "%2%1") -- swapping tašdid with vowels
text = mw.ustring.gsub(text, "(.)\217\145", "%1%1") -- implementing tašdid
text = mw.ustring.gsub(text, 'ih$', "")
text = mw.ustring.gsub(text, 'ih()', "i%1")
--[[ This is what should happen to West Persian:
Convert:
i to e
î to i
e to i
ay to ey
u to o
û to u
o to u
au to ou
]]--
return text
end
return export