A modult a Modul:fa-translit/doc lapon tudod dokumentálni
local export = {}
local U = mw.ustring.char
local fatHatan = U(0x64B) -- What is the Persian term for this?
local fathe = U(0x64E) -- also zabar
local zamme = U(0x64F) -- also piš
local kasre = U(0x650) -- also zir
local tashdid = U(0x651) -- also called shadda
local jazm = U(0x652)
local waw = U(0x0648)
local ye = U(0x06CC)
local group = "بپتثجچحخدذرزژسشصضطظغفقکگلمنوهی"
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', = 'u', = 'h', = 'i', = 'â',
-- displaying on separate lines as the viewing becomes distorted on these combinations
= "’",
= "’",
= "’",
= "’",
= "’",
-- diacritics
= "a",
= "e",
= "o",
= "", -- also sokun - no vowel
= "-", -- ZWNJ (zero-width non-joiner)
= "n",
-- 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
= ".", -- decimals
= ",", -- thousand
= "-ye" -- he ye (in ezâfe)
}
function export.tr(text, lang, sc)
text = mw.ustring.gsub(text, '(' .. tashdid .. '?)ه$', '%1e')
-- ou
-- NOT WORKING
text = mw.ustring.gsub(text, zamme .. waw .. '()', "ou%1")
-- ey
-- WORKING
text = mw.ustring.gsub(text, kasre .. ye .. '()', "ey%1")
text = mw.ustring.gsub(text, 'ىٰ', "â")
text = mw.ustring.gsub(text, 'ا' .. fatHatan, "an")
-- text = mw.ustring.gsub(text, 'الله', "ﷲ")
-- text = mw.ustring.gsub(text, 'لا', "ﻻ")
text = mw.ustring.gsub(text, '.', mapping)
text = mw.ustring.gsub(text, 'ou', "u")
text = mw.ustring.gsub(text, 'aâ', "â")
text = mw.ustring.gsub(text, 'âa', "a")
text = mw.ustring.gsub(text, 'ei', "i")
text = mw.ustring.gsub(text, 'ai', "ay")
text = mw.ustring.gsub(text, 'au', "aw")
text = mw.ustring.gsub(text, 'u()', "v%1")
text = mw.ustring.gsub(text, 'i()', "y%1")
text = mw.ustring.gsub(text, "()(" .. tashdid .. ")", "%2%1") -- swapping tašdid with vowels
text = mw.ustring.gsub(text, "(.)" .. tashdid, "%1%1") -- implementing tašdid
text = mw.ustring.gsub(text, 'eh$', "e")
text = mw.ustring.gsub(text, 'eh()', "e%1")
return text
end
return export