Icona de documentació de mòdul Documentació del mòdul[mostra] [modifica] [refresca]

A continuació es mostra la documentació transclosa de la subpàgina /ús. [salta a la caixa de codi]


Mòdul de suport per la plantilla {{zgh-pron}}. Vegeu la documentació de la plantilla.

local p = {}

-- single characters that map to IPA sounds   
local phonetic_chars_map = {
	["ⴰ"]="a", ["ⴱ"]="b", ["ⴳ"]="ɡ", ["ⴷ"]="d", ["ⴹ"]="dˤ", ["ⴻ"]="ə", 
    ["ⴼ"]="f", ["ⴽ"]="k", ["ⵀ"]="h", ["ⵃ"]="ħ", ["ⵄ"]="ʕ",["ⵅ"]="χ", 
    ["ⵇ"]="q", ["ⵉ"]="i", ["ⵊ"]="ʒ", ["ⵍ"]="l", ["ⵎ"]="m", ["ⵏ"]="n", 
    ["ⵓ"]="u", ["ⵔ"]="ɾ", ["ⵕ"]="ɾˤ", ["ⵖ"]="ʁ", ["ⵙ"]="s", ["ⵚ"]="sˤ", 
    ["ⵛ"]="ʃ", ["ⵜ"]="t", ["ⵟ"]="tˤ", ["ⵡ"]="w", ["ⵢ"]="j", ["ⵣ"]="z", 
    ["ⵥ"]="zˤ", ["ⵯ"]="ʷ", ["ⵠ"]="v"
}

function p.pronunciation(word)
	if type(word) == "table" then
		word = word.args[1] or word:getParent().args[1]
	end
	if not word or (word == "") then
		return
	end
	
	local phonetic = word
	
	-- then long consonants that are orthographically geminated.
	phonetic = mw.ustring.gsub(phonetic, "ⵔⵔ", "r")
	phonetic = mw.ustring.gsub(phonetic, "ⵕⵕ", "rˤ")
	phonetic = mw.ustring.gsub(phonetic, "(.)%1", "%1ː")
	phonetic = mw.ustring.gsub(phonetic, "ⵜⵛ", "ⵜⵛː")
	phonetic = mw.ustring.gsub(phonetic, "ⴷⵊ", "ⴷⵊː")
	
	phonetic = mw.ustring.gsub(phonetic, '.', phonetic_chars_map)
	phonetic = mw.ustring.gsub(phonetic, "s([bdɡzʒʁʕmnjwlɾr])", "z%1") -- voicing /z/ before voiced

	return phonetic
end
 
return p