Module:sandbox/pnb-convert

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

Test cases

Lua error in package.lua at line 80: module 'Module:pnb-convert/sandbox' not found

Progress

History

  • 19/08/23: A boilerplate module has been created (taken from Module:ur-convert/sandbox). First step will be to ensure that basic characters and diacritics are parsed correctly.
Done Done 19/08/23 – Diff:75689721 Diff:75689796
  • 19/08/23: Ensure aspirates with diacritics are parsed correctly Sort out prolonged vowels.

Kept in Mind

  • Parsing of aspirates + diacritics.
  • Shadda placed on letter being geminated, adhak placed after letter being geminated
  • Parsing of 'ain

Lua error in Module:module_categorization at line 299: Could not infer any languages or scripts from root pagename 'sandbox'


local U = mw.ustring.char
local gsub = mw.ustring.gsub
local export = {}

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

local he = "ہ"

-- Gurmukhi diacritics --
local sihari = "ਿ" -- zer
local bihari = "ੀ" -- zer + ye
local aunkar = "ੁ" -- pesh
local dulainkar = "ੂ" -- pesh + vow
local lavan = "ੇ" -- e
local dulavan = "ੈ" -- ai
local hora = "ੋ" -- o
local kanaura = "ੌ" -- au
local dutt = "੍" -- jazm
local adhak = " ੱ" -- tashdeed

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

local mapping = {
	 = 'ਆ',  = 'ਬ',  = 'ਪ',
	 = 'ਤ',  = 'ਟ',  = 'ਸ',
	 = 'ਜ',  = 'ਚ',  = 'ਹ',
	 = 'ਖ਼',  = 'ਦ',  = 'ਡ',
	 = 'ਜ਼',  = 'ਰ',  = "ੜ",
	 = 'ਜ਼',  = 'ਸ਼਼',  = 'ਸ',
	 = 'ਸ਼',  = 'ਸ',  = 'ਜ਼',
	 = 'ਤ',  = 'ਜ਼',  = 'ਗ਼',
	 = 'ਫ਼',  = 'ਕ਼',  = 'ਕ',
	 = 'ਗ',  = 'ਲ',  = 'ਮ',
	 = 'ਨ',  = 'ਵ',  = 'ਹ',
	 = 'ਯ',
	 = 'ਂ',
	
	 = 'ਣ',  = 'ਲ਼',  = 'ਕ',
	
	 = 'ਅ',
	 = '',
	 = '',
	 = 'ਓ',
	 = '',
	
	-- diacritics
	 = "",
	 = "" .. sihari .. "",
	 = "" .. aunkar .. "",
	 = "" .. dutt .. "", 
	 = "-", -- ZWNJ (zero-width non-joiner)
	
	-- ligatures
	 = "ला",
	 = "अल्लाह",
	
	-- kashida
	 = "-", -- kashida, no sound
	

-- numerals
	 = "੧",  = "੨",  = "੩",  ="੪",  = "੫", 
	 = "੬",  = "੭",  = "੮",  = "੯",  = "੦",
	 = "੧",  = "੨",  = "੩",  = "੪",  = "੫",
	 = "੬",  = "੭",  = "੮",  = "੯",  = "੦",
	
	-- punctuation (leave on separate lines)
     = "।", 
	 = "?", -- question mark
	 = ",", -- comma
	 = ";", -- semicolon
	 = '“', -- quotation mark
	 = '”', -- quotation mark
	 = "%", -- percent
	 = "‰", -- per mille
	 = ".", -- decimals
	 = ",", -- thousand
     = "-ਏ", 
	 = "-ਏ" -- he ye (in ezâfe)
}

local ain = 'ع'
local kzabar = 'ٰ'
local alif = 'ا'
local madda = 'آ'
local ye = 'ی'
local ye2 = 'ئ'
local ye3 = "ے"
local vao = "و"
local ye4 = "ۓ"
local he2 = "ۂ"
local aspirate = 'ھ'
local lam = 'ل'
local noon = 'ن'
local gunDia = '٘'

function export.tr(text, lang, sc)
	
	-- Tashdeed
    text = gsub(text, '()' .. tashdid,  "ੱ%1")
	text = gsub(text, '()' .. tashdid .. '()', "ੱ%1%2")
	--text = gsub(text, '()' .. ye .. '()' .. tashdid, "%1य्य%2")
	--text = gsub(text, '()' .. vao .. '()' .. tashdid, "%1व्व%2")
	
	-- prolonged vowels
	text = gsub(text, "" .. alif, "ਾ") -- prolonged alif
	text = gsub(text, "" .. zabar .. alif, "ਾ") -- prolonged alif but with zabar
	
	text = gsub (text, zabar .. ye .. "", "ੈ") -- zabar ye as ai
	text = gsub(text, "" .. ye .. "", "ੇ") -- ye as /e:/
	--text = gsub(text, "" .. ye .. jazm .. "", "ੇ") -- ye with jazm as /e:/
	
	text = gsub(text, zabar .. vao, "ੌ") -- vao as au
	text = gsub(text, "" .. vao, "ੋ") -- vao as /o:/
	
	-- aspirates
	text = gsub(text, "کھ", "ਖ")
	text = gsub(text, "گھ", "ਘ")
	text = gsub(text, "چھ", "ਛ")
	text = gsub(text, "جھ", "ਝ")
	text = gsub(text, "ٹھ", "ਠ")
	text = gsub(text, "ڈھ", "ਢ")
	text = gsub(text, "تھ", "ਥ")
	text = gsub(text, 'دھ', "ਧ")
	text = gsub(text, "پھ", "ਫ")
	text = gsub(text, "بھ", "ਭ")
	
  --- aspirate
	text = gsub(text, "(ک)" .. "()" .. aspirate, "ਖ%2")
    text = gsub(text, "(گ)" .. "()" .. aspirate, "ਘ%2")
    text = gsub(text, "(چ)" .. "()" .. aspirate, "ਛ%2")
    text = gsub(text, "(ج)" .. "()" .. aspirate, "ਝ%2")
    text = gsub(text, "(ٹ)" .. "()" .. aspirate, "ਠ%2")
    text = gsub(text, "(ڈ)" .. "()" .. aspirate, "ਢ%2")
    text = gsub(text, "(ت)" .. "()" .. aspirate, "ਥ%2")
    text = gsub(text, "(د)" .. "()" .. aspirate, "ਧ%2")
	text = gsub(text, "(پ)" .. "()" .. aspirate, "ਫ%2")
	text = gsub(text, "(ب)" .. "()" .. aspirate, "ਭ%2")
	text = gsub(text, "(ڑ)" .. "()" .. aspirate, "ੜ੍ਹ%2")
	text = gsub(text, "(م)" .. "()" .. aspirate, "ਮ੍ਹ%2")
	text = gsub(text, "(ن)" .. "()" .. aspirate, "ਨ੍ਹ%2")
	text = gsub(text, "(ل)" .. "()" .. aspirate, "ਲ੍ਹ%2")
	
	text = mw.ustring.gsub(text, '.', mapping)
	return text
end
return export