Module:User:Sameerhameedy/fa-IPA-ira

Hello, you have come here looking for the meaning of the word Module:User:Sameerhameedy/fa-IPA-ira. In DICTIOUS you will not only get to know all the dictionary meanings for the word Module:User:Sameerhameedy/fa-IPA-ira, but we will also tell you about its etymology, its characteristics and you will know how to say Module:User:Sameerhameedy/fa-IPA-ira in singular and plural. Everything you need to know about the word Module:User:Sameerhameedy/fa-IPA-ira you have here. The definition of the word Module:User:Sameerhameedy/fa-IPA-ira will help you to be more precise and correct when speaking or writing your texts. Knowing the definition ofModule:User:Sameerhameedy/fa-IPA-ira, as well as those of other words, enriches your vocabulary and provides you with more and better linguistic resources.

This is a private module sandbox of Sameerhameedy, for their own experimentation. Items in this module may be added and removed at Sameerhameedy's discretion; do not rely on this module's stability.


local rsubn = mw.ustring.gsub
local U = mw.ustring.char
local export = {}
local zabar = U(0x64E)
local zer = U(0x650)
local pesh = U(0x64F) 
local tashdid = U(0x651) -- also called shadda
local jazm = U(0x652) -- sukoon
local he = "ه"
local zwnj = U(0x200C)
local highhmz = U(0x654)


local convert_consonants = {
-- STOP! fa-IPA should remove incorrect characters, 
-- if an incorrect character is appearing, check fa_IPA not here
	 = "ب",
	 = "د",
	 = "ب", 
	 = "چ", 
	 = "د", 
	 = "ف", 
	 = "گ", 
	 = "غ", 
	 = he, 
	 = "ج", 
	 = "ک", 
	 = "ل", 
	 = "م", 
	 = "ن", 
	 = "پ", 
	 = "ق", 
	 = "ر", 
	 = "س", 
	 = "ش",
	 = "ت", 
	 = "د", --only for Hazaragi
	 = "ت", --only for Hazaragi
	 = "و", 
	 = "خ", 
	 = "ی", 
	 = "ز", 
	 = "ژ", 
	 = "ئ",
}

local convert_vowels = {
	 = zabar,  = "ا",  = zer, 
	 = pesh,  = "و",  = "ی",
}

local vowels = "aeoiu" --including â causes issues
local consonants = "bptjčxdrzžsš'ğfqkglmnwvwhy"
local dc_consonants = "âdrwvuzž"..jazm..""

function export.tr(text, lang, sc)
	text = rsubn(text, " | ", "# | #")
	text = "##" .. rsubn(text, " ", "# #") .. "##"
	text = rsubn(text, "`", "")
	text = rsubn(text, " ", "")
	text = rsubn(text, ",", "] ,[")
	text = rsubn(text, "%]", "#]#")
	text = rsubn(text, "%[", "#[#")
	
	-- remove unpronounced or incorrect letters
	text = rsubn(text, "", "")
	text = rsubn(text, "v", "w") 
	text = rsubn(text, "iy", "ey")
	text = rsubn(text, "()%1", "%1"..tashdid.."")
	text = rsubn(text, "()()", "%1"..jazm.."%2")
	text = rsubn(text, "()()", "%1"..jazm.."%2")
	text = rsubn(text, "#â", "#آ")
	text = rsubn(text, "'â", "آ")
	text = rsubn(text, "()()", "%1h-")
	text = rsubn(text, "()()â", "%1آ")
	text = rsubn(text, "()()â", "%1"..zwnj.."آ")
	text = rsubn(text, "()()()", "%1â%3")
	text = rsubn(text, "()()()", "%1"..zwnj.."â%3")
	text = rsubn(text, "()()()", "%1%3")
	text = rsubn(text, "()()()", "%1"..zwnj.."%3")
	text = rsubn(text, "#()", "#â%1")
	text = rsubn(text, "()#", "%1h#")
	text = rsubn(text, "()#", "ء#")
	text = mw.ustring.gsub(text, '.', convert_consonants)
	text = mw.ustring.gsub(text, '.', convert_vowels)
	
	text = rsubn(text, "", "")
	text = rsubn(text, "#", "")
	return text
end

return export