This module contains the shortcuts and subsequent rules for generating Arabic text using ASCII through {{subst:chars|ar}}
. Among other things, it automatically converts hamzas to the correct form (in most cases at least) and adds sukūn and shadda.
U = require("Module:string/char")
local fatHa = U(0x64E)
local fatHatan = U(0x64B)
local kasratan = U(0x64D)
local Dammatan = U(0x64C)
local kasra = U(0x650)
local Damma = U(0x64F)
local superscript_alif = U(0x670)
local sukuun = U(0x652)
local shadda = U(0x651)
local vowel_diacritics = fatHa .. kasra .. Damma .. fatHatan .. kasratan .. Dammatan
local short_vowel = ""
local taTwiil = U(0x640)
local alif = "ا"
local waaw = "و"
local yaa = "ي"
local alif_maqSuura = "ى"
local laam = "ل"
local madda = "آ"
local waSla = "ٱ"
local hamza = "ء"
local alif_hamza = "أ"
local alif_hamza_below = "إ"
local yaa_hamza = "ئ"
local waaw_hamza = "ؤ"
local taa_marbuuTa = "ة"
local article = alif .. laam
local consonants = "بتثجحخدذرزسشصضطظعغقفلكمنءة"
local consonant = ""
local sun_letters = "تثدذرزسشصضطظلن"
local sun_letter = ""
-- Mostly ], some ]
replacements = {
= {
= madda,
= fatHa .. alif_maqSuura,
= superscript_alif,
= taa_marbuuTa,
= "ذ",
= "ض",
= "ظ",
= "ع",
= "خ",
= article,
= "،",
= "؛",
= "؟",
},
= {
= fatHa .. alif,
= kasra .. yaa,
= Damma .. waaw,
= fatHatan,
= kasratan,
= Dammatan,
= alif,
= waSla,
= "ب",
= "ث",
= "د",
= hamza,
= hamza,
= hamza,
= "ع",
= "ع",
= "ع",
= "ف",
= "ض",
= "غ",
= "ه",
= "ح",
= "ح",
= "ج",
= "ك",
= "خ",
= "ل",
= "ﷲ", -- Allah ligature
= "م",
= "ن",
= "پ",
= "ق",
= "ر",
= "س",
= "ص",
= "ص",
= "ت",
= "ط",
= "ط",
= "ڤ",
= waaw,
= yaa,
= "ش",
= "ز",
= "ظ",
= taTwiil,
= taTwiil,
= taTwiil,
= taTwiil,
},
= {
= fatHa,
= kasra,
= Damma,
= alif .. kasra,
= alif .. Damma,
)" .. fatHatan] = "%1" .. fatHatan .. alif,
= "%1" .. shadda,
= "%1" .. shadda,
},
= {
)"] = "%1" .. sukuun .. "%2",
)" .. "()"] = "%1" .. sukuun .. "%2",
= { alif_hamza, after = "" },
= alif_hamza_below .. kasra,
= "%1" .. alif_hamza_below .. kasra,
},
= {
-- remove sukuun from definite article before sun letter
= article .. "%1",
= "%1" .. article .. "%2",
-- to add final sukuun
= "",
= "%1" .. shadda,
)%1"] = "%1" .. shadda,
= kasra .. yaa_hamza,
= yaa_hamza .. kasra,
= {
Damma .. waaw_hamza,
after = "",
},
= fatHa .. alif_hamza,
)" .. hamza .. fatHa] = "%1" .. alif_hamza .. fatHa,
},
= {
= "%1" .. waSla .. laam,
= "%1" .. waSla .. laam,
= "%1" .. waSla .. laam,
= "%1" .. waSla .. laam,
= "%1" .. waSla .. laam,
},
}
-- = "",
return replacements