For faster navigation, this Iframe is preloading the Wikiwand page for Module:Prononciation.

Module:Prononciation

 Documentation[voir] [modifier] [historique] [purger]

Utilisation

Ce module est utilisé par le modèle ((Prononciation)).

Fonctions exportables :

Modules externes et autres éléments dont ce module a besoin pour fonctionner :

Exemples

Pour des exemples, voir la page de test permettant de tester diverses modifications apportées.

local p = {}

function p.prononciation(frame) --récupère la prononciation telle qu'indiquée sur l'item
	local args = frame:getParent(frame).args --récupère les paramètres passés au modèle

	local arg1 = args[1] and mw.text.trim(args[1]) or nil
	local arg2 = args[2] and mw.text.trim(args[2]) or nil

	if (arg2 and arg2 ~= '') then --si le paramètre (({2))} existe (on présume que (({1))} existe du coup)
		return '<sup class="prononciation noprint">[[:Fichier:' .. arg1 .. '|' .. arg2 .. ']]</sup>' -- (fin de la fonction)
	end
	if (arg1 and arg1 ~= '') then --si le paramètre (({1))} existe — seul
		return '<sup class="prononciation noprint">[[:Fichier:' .. arg1 .. '|Écouter]]</sup>' -- (fin de la fonction)
	end

	local entity = mw.wikibase.getEntity() --si aucun des paramètres n'existe, on charge l'item Wikidata associé à l'article
	if not entity then --si cet élément n'existe pas ajoute la page à la catégorie de demande (fin de la fonction)
		return "[[Catégorie:Demande de prononciation audio]]"
	end

	local wikidataMod = require "Module:Wikidata"
	local pron_fr = wikidataMod.formatStatements({entity=entity, property='P443', qualifier='P407', qualifiervalue='Q150'}) --récupère la prononciation en français
	if pron_fr then
		return '<sup class="prononciation noprint">[[:Fichier:' .. pron_fr .. '|Écouter]]</sup>' --retourne la prononciation si elle a été trouvée (fin de la fonction)
	end
	local pron = wikidataMod.formatStatements({entity=entity, property='P443', rank='best', numval=1}) --récupère la prononciation tout court
	if pron then
		return '<sup class="prononciation noprint">[[:Fichier:' .. pron .. '|Écouter]]</sup>' --retourne la prononciation si elle a été trouvée (fin de la fonction)
	end
	return "[[Catégorie:Demande de prononciation audio]]" --s'il n'y a décidément pas ajoute la page à la catégorie de demande (fin de la fonction)
end

return p
{{bottomLinkPreText}} {{bottomLinkText}}
Module:Prononciation
Listen to this article

This browser is not supported by Wikiwand :(
Wikiwand requires a browser with modern capabilities in order to provide you with the best reading experience.
Please download and use one of the following browsers:

This article was just edited, click to reload
This article has been deleted on Wikipedia (Why?)

Back to homepage

Please click Add in the dialog above
Please click Allow in the top-left corner,
then click Install Now in the dialog
Please click Open in the download dialog,
then click Install
Please click the "Downloads" icon in the Safari toolbar, open the first download in the list,
then click Install
{{::$root.activation.text}}

Install Wikiwand

Install on Chrome Install on Firefox
Don't forget to rate us

Tell your friends about Wikiwand!

Gmail Facebook Twitter Link

Enjoying Wikiwand?

Tell your friends and spread the love:
Share on Gmail Share on Facebook Share on Twitter Share on Buffer

Our magic isn't perfect

You can help our automatic cover photo selection by reporting an unsuitable photo.

This photo is visually disturbing This photo is not a good choice

Thank you for helping!


Your input will affect cover photo selection, along with input from other users.

X

Get ready for Wikiwand 2.0 🎉! the new version arrives on September 1st! Don't want to wait?