Module:ne-convert2

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


-- Feel free do edit.
-- I haven't been able to solve it yet

local U = require("Module:string/char")
local gsub = mw.ustring.gsub
local export = {}

local zabar = U(0x64E)
local zer = U(0x650)
local pesh = U(0x64F)
local tashdid = U(0x651) -- also called shadda
local jazm = "ْ"
local he = "ہ"

local consonants = "ببپتثجچحخدذرزژسشصضطظعغفقکگلࣇمنݨوہھٹڈڑں"
local consonantS = "ببپتثجچحخدذرزژسشصضطظعغفقکگلࣇمنݨہھٹڈڑں"
local vowels = "ایئےۓوؤ"
local hes = "ہح"
local diacritics = "َُِّْٰ"
local ZZP = "َُِ" -- zzp + kahri zabar
local PZ = "َُ" --Zabar pesh

local mapping = {
	 = 'ā',  = 'b',  = 'p',  = 't',  = 'ṭ',  = 's',
	 = 'j',  = 'c',  = 'h',  = 'x', 
	 = 'd',  = 'ḍ',  = 'z',  = 'r',  = "ṛ",  = 'z',  = 'ž',
	 = 's',  = 'ś',  = 's',  = 'z', 
	 = 't',  = 'z',  = 'ġ',  = 'f',  = 'q',
	 = 'k',  = 'g',  = 'ṇ',  = 'ḷ',
	 = 'l',  = 'm',  = 'n',  = 'ō',  = 'h',  = 'y',  = 'ē',  = ".",  = '̃',

	 = "h",
	

	 = 'a',
	 = '',
	 = '', 
	 = 'ō',
	 = '',
	
	-- diacritics
	 = "a",
	 = "i",
	 = "u",
	 = "", -- also sukun - no vowel
	 = "-", -- ZWNJ (zero-width non-joiner)
	
	-- ligatures
	 = "lā",
	 = "allāh",
	
	-- kashida
	 = "-", -- kashida, no sound
	
	-- 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", 
	 = "-e" -- he ye (in ezâfe)
}

local ain = 'ع'
local alif = 'ا'
local ye = 'ی'
local ye2 = 'ئ'
local ye3 = "ے"
local vao = "و"
local aspirate = 'ھ'
local ghunna = 'ں'

function export.tr(text, lang, sc)
	
	-- EXCEPTIONS - leave as they are, unless they have been sorted out elsewhere
	text = gsub(text, '()' .. ye .. ghunna, "%1ē̃")
	text = gsub(text, zabar .. aspirate .. "(ی)" , "hɛ̄")
	text = gsub(text, zabar .. aspirate .. "(و)" , "hɔ̄")
	text = gsub(text, "ؤ" .. pesh, "ū")
	text = gsub(text, "وہ", "vo")

	-- Tashdeed
	text = gsub(text, '()' .. tashdid, "%1%1")
	text = gsub(text, '()' .. tashdid .. '()', "%1%1%2")
	
	-- For some reason the tashdeed gets pushed after the other diacritics, so this line is necessary for tashdeed to work with other diacritics
	text = gsub(text, '()' .. '()' .. tashdid, "%1%1%2")
	
	-- e, instead of i
	text = gsub(text, jazm .. '()' .. zer .. '()' .. alif, "%1e%2ā")
	
	-- tanween diacritic
	text = gsub(text, '()' .. 'ً' .. alif, "%1an")
	text = gsub(text, alif .. 'ً', "an")
	text = gsub(text, '()' .. 'ً', "%1an")

	-- khari zabar --
	text = gsub(text, '()' .. 'ٰ', "ā")
	text = gsub(text, '()' .. 'ٰ' .. '()', "%1ā")
	
	-- ‘ain
	text = gsub(text, alif .. ain  .. '()', "ɛ̄%1")
			text = gsub(text, '()' .. ain .. he, "%1a")
		text = gsub(text, '()' .. ain, "%1")
		text = gsub(text, ain .. zer  .. '()', "i%1")
		text = gsub(text, ain .. pesh  .. '()', "u%1")
	text = gsub(text, ain .. zer .. ye .. '()', "ī%1")
    text = gsub(text, ain .. pesh .. vao .. '()', "ū%1")

	-- Vao
	text = gsub(text, vao .. '()', "v%1")
	
	-- یے
	text = gsub(text,'()' .. ye .. ye3, "%1ië")
	-- ئے
	text = gsub(text, '()' .. pesh .. ye2 .. ye3, "%1uë")
	text = gsub(text, '()' .. ye2 .. ye3, "%1aë")
	-- سیب (example)
	text = gsub(text, '()' .. ye .. '()', "%1ē%2")
	-- کئی (example)
	text = gsub(text, '()' .. pesh .. ye2 .. ye, "%1uï")
	text = gsub(text, '()' .. ye2 .. ye, "%1aï")
	-- اَے
	text = gsub(text, alif .. zabar .. ye3, "ɛ̄")
	-- َے
	text = gsub(text, zabar .. ye3, "ɛ̄")
	-- izafat
	text = gsub(text, '()' .. zer .. " ", "%1-e ")
	
	-- Fatha Majhool --
	text = gsub(text, "()" .. zabar .. aspirate .. "()" .. "()" .. jazm, "%1hêh%3")
	text = gsub(text, "()" .. zabar .. "()"  .. jazm .. "()" , "%1êh%3")
	text = gsub(text, "()" .. zabar .. "()"  .. jazm , "%1êh")
	
    -- do-chashme-he zabar, zer, pesh
    text = gsub(text, zer .. aspirate .. ye .. ghunna, "hï̃")
    text = gsub(text, "()" .. "()" .. aspirate, "%1h%2")
    text = gsub(text, "()" .. aspirate .. ye .. "", "%1hī")
	
	-- medial/final consonants
	text = gsub(text, zabar .. he .. zer .. ye, "ahī")
	text = gsub(text, zabar .. he .. alif, "ahā")
	text = gsub(text, zabar .. he .. '()', "ah%1")
	text = gsub(text, '()' .. alif, "%1ā")
	text = gsub(text, '()' .. tashdid .. alif, "%1%1ā")
	
	text = gsub(text, '()' .. vao, "%1ō")
	text = gsub(text, '()' .. tashdid .. vao, "%1%1ō")
	
	text = gsub(text, alif .. '()', "a%1")
	text = gsub(text, alif .. zabar .. '()', "a%1")
	text = gsub(text, alif .. zabar .. vao .. '()', "ɔ̄%1")
	text = gsub(text, alif  .. vao .. '()', "ō%1")
	text = gsub(text, alif .. zabar .. ye .. '()', "ɛ̄%1")
	text = gsub(text, alif .. pesh .. '()', "u%1")
	text = gsub(text, alif .. zer .. '()', "i%1")
	text = gsub(text, pesh .. vao, "ū")
	text = gsub(text, alif .. zer .. ye .. '()', "ī%1")
	text = gsub(text, alif .. zer .. ye .. "", "ī")
	text = gsub(text, alif  .. ye .. '()', "ē%1")
	
	-- diacritics
	text = gsub(text, "()" .. zabar .. vao, "%1ɔ̄")
	text = gsub(text, "()" .. zabar .. ye, "%1ɛ̄")
	text = gsub(text, "()" .. zabar .. ye3, "%1ɛ̄")
	text = gsub(text, "()" .. ye .. " ", "%1ī ")
	text = gsub(text, "()" .. zer .. ye, "%1ī")
	
	-- final he + short vowel disregards the he and transliterates the vowel
	text = gsub(text, ye .. he , "ye")
	text = gsub(text, ye .. alif , "yā")		
	text = gsub(text, "()" .. he , "%1e")
	
	--
	text = gsub(text, zabar .. he .. "()" , "ah%1")
	text = gsub(text, zabar .. he , "a")
	--
	
	text = gsub(text, "ۂ", "a-e")
	text = mw.ustring.gsub(text, 'ahē', "hɛ̄")
	text = mw.ustring.gsub(text, 'ahō', "hɔ̄")
text = mw.ustring.gsub(text, 'hiē', "hī") 
	text = mw.ustring.gsub(text, '.', mapping)

	text = mw.ustring.gsub(text, 'ōā', "vā")
	text = mw.ustring.gsub(text, 'ɔ̄ā', "vā")
	text = mw.ustring.gsub(text, 'ōا', "vā")
	text = mw.ustring.gsub(text, 'ɔ̄aاa', "avā")
	text = mw.ustring.gsub(text, 'ɔ̄ا', "vā")
	text = mw.ustring.gsub(text, 'ɔ̄ا', "vā")
	
	-- Changed these to 'iy(*)', because they will be used for with ی, which are normally written as 'iy'
	text = mw.ustring.gsub(text, 'īā', "iyā")
	text = mw.ustring.gsub(text, 'īa', "iya")
	--
	
	text = mw.ustring.gsub(text, 'aا', "ā")
	text = mw.ustring.gsub(text, 'اē', "ē")
	text = mw.ustring.gsub(text, 'īا', "yā")
	text = mw.ustring.gsub(text, 'êha', "êhê")
	
	-- vao as a medial consonant
	text = mw.ustring.gsub(text, "ūa", "uva")
	text = mw.ustring.gsub(text, "ɔ̄()", "av%1")
	--

    -- Final corrections
	text = mw.ustring.gsub(text, "āa", "ā")
	text = mw.ustring.gsub(text, "āā", "ā")
	text = mw.ustring.gsub(text, "aa", "ā")
        text = mw.ustring.gsub(text, "ë", "ē")
        text = mw.ustring.gsub(text, "ï", "ī")
	return text
end
return export