Module:ps-translit/sandbox

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


local m_str_utils = require("Module:string utilities")

local U = m_str_utils.char
local gsub = m_str_utils.gsub

local export = {}

local zwar = U(0x64E)
local zer = U(0x650)
local pesh = U(0x64F)
local tashdid = U(0x651) -- also called shadda
local zwarakay = U(0x659) -- Pashto /ə/
local jazm = "ْ"
local he = "ہ"

local ain = 'ع'
local alif = 'ا'
local ye = 'ي'
local waw = "و"
local nasal = 'ں'

local consonants = "بپتټثجځچڅحخدډذرړزژږسشښصضطظعغفقکګلمنڼوه"
local consonantS = "بپتټثجځچڅحخدډذرړزژږسشښصضطظعغفقکګلمنڼه"
local consonantS2 = "بپتټثجځچڅحخدډذرړزژږسشښصضطظعغفقکګلمنڼوهی" 
local vowels = "اآیېيۍئےو"
local hes = "هح"
local diacritics = "َُِّْٰٙ"
local ZZPZ = "َُِٙ"

local mapping = {
	 = 'â',  = 'b',  = 'p',  = 't',  = 'ṭ',  = 's̱',
	 = 'j',  = 'ź',  = 'č',  = 'ś',  = 'ḥ',  = 'x', 
	 = 'd',  = 'ḍ',  = 'ẕ',  = 'r',  = "ṛ",  = 'z',  = 'ž',  = 'ǵ',
	 = 's',  = 'ś',  = 'x̌',  = 'ṣ',  = 'ẓ', 
	 = 't̤',  = 'z̤',  = 'ʻ',  = 'ǧ',  = 'f',  = 'q',
	 = 'k',  = 'g',  = 'ṇ',
	 = 'l',  = 'm',  = 'n',  = 'w',  = 'h',  = 'y',  = 'ṉ', 

	 = "ëw",  = "ëy",  = 'ëy',  = 'e',  = 'ay',  = 'ay',  = 'ë',
	
	-- diacritics
	 = "a",
	 = "ĭ",
	 = "ŭ",
	 = "ë",
	 = "", -- 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
}

function export.tr(text, lang, sc)
	
	-- EXCEPTIONS - leave as they are, unless they have been sorted out elsewhere

    text = gsub(text, "ن٘", "ṉ")
    text = gsub(text, "اللہ", "allāh")
    
  	-- diacritics
	text = gsub(text, pesh .. waw .. jazm .. "", "u")
	text = gsub(text, "()" .. zer .. ye, "%1i")
    text = gsub(text, jazm .. alif, "â")
    
	-- Initial alif
	text = gsub(text, alif .. zwar .. '()', "a%1")
	text = gsub(text, alif .. zer .. ye .. jazm .. "", "i")

	text = gsub(text, alif .. zer, "ĭ")
	text = gsub(text, alif .. waw .. jazm .. "", "o")

	text = gsub(text, alif .. pesh .. waw, "u")
	text = gsub(text, alif .. pesh .. waw .. jazm .. "", "u")	
	text = gsub(text, alif .. pesh, "ŭ")

	-- Tashdeed
	text = gsub(text, '()' .. tashdid, "%1%1")
	text = gsub(text, '()' .. tashdid .. '()', "%1%1%2")
	text = gsub(text, '()' .. ye .. '()' .. tashdid, "%1yy%2")
	text = gsub(text, '()' .. waw .. '()' .. tashdid, "%1ww%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")
	
	-- tanween diacritic / no need to mess about
	text = gsub(text, '()' .. 'ً' .. alif, "%1an")
	text = gsub(text, alif .. 'ً', "an")
	text = gsub(text, '()' .. 'ً', "%1an")

	-- tall zwar -- / no need to mess about
	text = gsub(text, '()' .. 'ٰ', "á")
	text = gsub(text, '()' .. 'ٰ' .. '()', "%1á")

	-- ‘ain
	text = gsub(text, alif .. ain , "â‘") 
	text = gsub(text, ain .. alif  .. '()', "ʻâ%1") 
	text = gsub(text, '()' .. ain .. he, "%1ʻa")
	text = gsub(text, '()' .. '(?)' .. ain, "%1%2ʻ")
	text = gsub(text, ain .. zer  .. '()', "ʻĭ%1")
	text = gsub(text, ain .. pesh  .. '()', "ʻŭ%1")
	text = gsub(text, ain .. zer .. ye .. '()', "ʻi%1")
    text = gsub(text, ain .. pesh .. waw .. '()', "ʻu%1")
    
    ---  alif
    text = gsub(text, '()' .. zwar .. alif, "%1â")
	text = gsub(text, '()' .. alif, "%1â")
	text = gsub(text, '()' .. tashdid .. alif, "%1%1â")
  
	-- waw
	text = gsub(text, waw .. '()', "w%1")
    text = gsub(text, 'ُو', "u")
	

	-- medial/final consonants

    --- (e) -- works
	text = gsub(text, '()' .. ye .. jazm .. '()', "%1i%2")
	
    --- he 
	text = gsub(text, zwar .. he .. zer .. ye, "ahi")
	text = gsub(text, zwar .. he .. alif, "ahâ")
	text = gsub(text, zwar .. he .. '()', "ah%1")

    --- vao

	text = gsub(text, '()' .. waw, "%1o")
	text = gsub(text, '()' .. tashdid .. waw, "%1%1o")

	text = gsub(text, '()' .. tashdid .. zer .. ye .. jazm .. alif, "%1%1iyâ")
	text = gsub(text, zer .. ye .. jazm .. alif, "iyâ")
	text = gsub(text, zer .. ye .. alif, "iyâ")
	
	--- ye
	text = gsub(text, ye .. zabar .. alif, "yâ")
	text = gsub(text, '()' .. ye, "%1i")

	text = gsub(text, '.', mapping)

	
	text = gsub(text, 'ĭy', "i")
	text = gsub(text, 'ŭw', "u")

	text = gsub(text, 'aa', "â")
	--

	return text
end
return export