Module:pa-Arab-translit

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

This module is in beta stage.
Module has been updated. It should work as expected for majority of the words. It may have problems with diphthongs and a minority of Arabic loanwords. Module needs verification from other native Punjabi speakers who understand Shahmukhi lemmas with diacritics, because this is quite difficult to get your head wrapped around. Check documentation for further listed problems.
This module will transliterate text in the Shahmukhi script. It is also used to transliterate Old Punjabi, Pahari-Potwari, and Saraiki.

The module should preferably not be called directly from templates or other modules. To use it from a template, use {{xlit}}. Within a module, use Module:languages#Language:transliterate.

For testcases, see Module:pa-Arab-translit/testcases.

Functions

tr(text, lang, sc)
Transliterates a given piece of text written in the script specified by the code sc, and language specified by the code lang.
When the transliteration fails, returns nil.

Introduction

....

Exceptions

The following words do not need any diacritics:

Notes

  • نْ should be written as ن٘ when it is from an inherited nasal vowel (i.e. most cases)
  • Shahmukhi distinguishes Sukoon/Jazm diacritic ءْ with the absence of a diacritic ء;
    • Sukoon/Jazm should be used where there is a true consonant cluster, such as in تْرے (trai), بْھرا (bhrā), گْراں (grāṉ) etc.
    • The diacritic should be absent where there is a weak or semi-deleted schwa ( or , rarely also and ), most commonly at the end of words such as in مَجّھ (majjhă), ناࣇ (nāḷĭ) etc. but also medially as in چَھڈّݨا (chaḍḍăṇā), دَسّݨا (dassăṇā) etc.
  • Final ہ (h) should be written double if it joins to the previous letter, such as in مُون٘ہہ (mūṉh), ایہہ (eh) but not اوہ (oh). This does not apply when final ہ (h) is used as a vowel, e.g. in چُوچَہ (cūcā).

To do list

  • Sort out any problems with diphthongs
    • make sure all diphthongs are represented correctly
    • change īū -> iyū
  • Arabic loanwords
    • al and non al words
    • archaic ha murtaba tah
  • Diacritics detector
  • Distinction between a schwa and loanwords ـہ | need not diacritics when a schwa ('..a') and need when loanword ('..ah')

Working Template Examples

Headword-line templates

With replacing header:
{{pa-noun|gur=ਮਸੀਤ|g=f|head=مَسِیت}}

Check: مسیت (example can't be shown on module documentation)


Without (needing to) replacing header:
{{pa-noun|g=f|gur=ਅਲਮਾਰੀ}}

Check: الماری (example can't be shown on module documentation)

Other templates

{{ux|pa|مَیں کَلّھ لَندَن جا رہا واں۔|I am going to London tomorrow.}}:

مَیں کَلّھ لَندَن جا رِہا واں۔
maiṉ kallh landan jā rihā vāṉ.
I am going to London tomorrow.

Status

Last updated: 23/08/2021


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

local U = m_str_utils.char
local gsub = m_str_utils.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 ain = 'ع'
local alif = 'ا'
local ye = 'ی'
local ye2 = 'ئ'
local ye3 = "ے"
local vao = "و"
local aspirate = 'ھ'
local nasal = 'ں'

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

local mapping = {
	 = 'ā',  = 'b',  = 'ḇ',  = 'p',  = 't',  = 'ṭ',  = 's̱',
	 = 'j',  = 'ǰ',  = 'c',  = 'ḥ',  = 'x', 
	 = 'd',  = 'ḍ',  = 'ḏ',  = 'ẕ',  = 'r',  = "ṛ",  = 'z',  = 'ž',
	 = 's',  = 'ś',  = 'ṣ',  = 'ẓ', 
	 = 't̤',  = 'z̤',  = 'ʻ',  = 'ġ',  = 'f',  = 'q',
	 = 'k',  = 'g',  = 'g̈',  = 'ṇ',  = 'ḷ',
	 = 'l',  = 'm',  = 'n',  = 'v',  = 'h',  = 'y',  = ".",  = 'ṉ',

	 = "h", 
	 = "'o",
	
	-- 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", 
	 = "h-e" -- he ye (in izafat)
}

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

	text = gsub(text, '()' .. ye .. vao .. nasal, "%1eyoṉ") -- needs to be fixed
	text = gsub(text, '()' .. ye .. vao, "%1eyo") -- needs to be fixed
    text = gsub(text, '()' .. ye .. '()' , "%1e%2") -- needs to be fixed
    text = gsub(text, '()' .. ye .. alif, "%1eyā") -- needs to be fixed
	text = gsub(text, zabar .. aspirate .. "(ی)" , "hai") -- needs to be fixed
	text = gsub(text, zabar .. aspirate .. "(و)" , "hau") -- needs to be fixed
	text = gsub(text, "ئے", "'e")
	text = gsub(text, "َے", "ai")
	text = gsub(text, "ے", "e")
	text = gsub(text, "ہہ", "h")
    text = gsub(text, "اے", "e")
    text = gsub(text, "اَے", "ai")
    text = gsub(text, "ن٘", "ṉ")
    text = gsub(text, "اللہ", "allāh")
    text = gsub(text, "ؤ" .. pesh, "ū") -- needs to be fixed

    --text = gsub(text, "ُھوِیں", "vīṉ")
    text = gsub(text, "()" .. "وِیں", "%1vīṉ")
    
  	-- diacritics
	text = gsub(text, "()" .. zer .. ye .. alif, "%1īyā")
	text = gsub(text, pesh .. vao .. jazm .. "", "ū")
	text = gsub(text, "()" .. zabar .. vao, "%1au")
	text = gsub(text, "()" .. zabar .. ye, "%1ai")
	text = gsub(text, "()" .. zabar .. ye3, "%1ai")
	text = gsub(text, "()" .. zer .. ye, "%1ī")
    text = gsub(text, jazm .. alif, "ā")
    
    text = gsub(text, ye2 .. zer .. ye, "'ī")
    text = gsub(text, "" .. alif .. ye2 .. "()", "ā'i%1") -- needs to be fixed
    
	-- Initial alif
	text = gsub(text, alif .. zer, "ī")
	text = gsub(text, alif .. zabar .. '()', "a%1")

	text = gsub(text, alif .. zabar .. vao .. jazm .. "", "au")
	text = gsub(text, alif .. vao .. jazm .. "", "o")
	text = gsub(text, alif .. zabar .. ye .. jazm .. "", "ai")
	text = gsub(text, alif .. ye .. jazm .. "", "e")

	text = gsub(text, alif .. pesh .. vao, "ū")
	text = gsub(text, alif .. pesh .. vao .. jazm .. "", "ū")	
	text = gsub(text, alif .. pesh, "u")

    -- do-chashme-he zabar, zer, pesh / no need to mess about
    --- works for short vowels
    text = gsub(text, "()" .. aspirate, "h%1")
    text = gsub(text, pesh .. aspirate .. vao .. jazm .. "", "ū")
    text = gsub(text, zabar .. aspirate .. vao .. jazm .. "", "ai")
    text = gsub(text, '()' .. aspirate .. ye .. jazm .. "", "%1he")
   

	-- Tashdeed
	text = gsub(text, '()' .. tashdid, "%1%1")
	text = gsub(text, '()' .. tashdid .. '()', "%1%1%2")
	text = gsub(text, '()' .. ye .. '()' .. tashdid, "%1yy%2")
	text = gsub(text, '()' .. vao .. '()' .. tashdid, "%1vv%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")

	-- khari zabar -- / 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 .. zabar .. vao .. '()', "‘au%1")
	text = gsub(text, ain .. zabar .. ye .. '()', "‘ai%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")
    
    ---  alif
    text = gsub(text, '()' .. zabar .. alif, "%1ā")
	text = gsub(text, '()' .. alif, "%1ā")
	text = gsub(text, '()' .. tashdid .. alif, "%1%1ā")
  
	-- Vao
	text = gsub(text, vao .. '()', "v%1")
    text = gsub(text, 'ُو', "ū")
	text = gsub(text, '()' .. zabar .. vao .. alif, "%1avā")
	

	-- medial/final consonants

    --- (e) -- works
	text = gsub(text, '()' .. ye .. jazm .. '()', "%1e%2")
	text = gsub(text, '()' .. ye3, "%1e")
	text = gsub(text, '()' .. zabar .. ye3, "%1ai")
    --- izafat
	text = gsub(text, '()' .. zer .. " ", "%1-e ")

    --- he 
	text = gsub(text, zabar .. he .. zer .. ye, "ahī")
	text = gsub(text, zabar .. he .. alif, "ahā")
	text = gsub(text, zabar .. he .. '()', "ah%1")

    --- vao

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

	text = gsub(text, '()' .. tashdid .. zer .. ye .. jazm .. alif, "%1%1īyā")
	text = gsub(text, zer .. ye .. jazm .. alif, "īyā")
	text = gsub(text, zer .. ye .. alif, "iyā")
	
	--- ye
	text = gsub(text, ye .. zabar .. alif, "yā")
	text = gsub(text, '()' .. ye, "%1ī")
	
	text = gsub(text, "ۂ", "a-e")

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

	
	-- Changed these to 'iy(*)', because they will be used for with ی, which are normally written as 'iy'
	text = gsub(text, 'īā', "iyā")
	text = gsub(text, 'īa', "iya")

	text = gsub(text, 'aa', "ā")
	--
	
    text = gsub(text, 'ئy', "'ī") 
    text = gsub(text, "" .. 'ئے', "'ye")
    text = gsub(text, "īے", "iye")
    text = gsub(text, "iīe", "iye")
    text = gsub(text, "īe", "iye")
    text = gsub(text, "iīv", "iyo")
    text = gsub(text, "ئiy", "'ī")

	return text
end
return export