Modul:Wikidata: Unterschied zwischen den Versionen

AZ: Die Seite wurde neu angelegt: -- module local variables local wiki = { langcode = mw.language.getContentLanguage().code } -- internationalisation local i18n = { ["errors"] = { ["property-not-found"] = "Eigenschaft nicht gefunden.", ["entity-not-found"] = "Wikidata-Eintrag nicht gefunden.", ["entity-not-valid"] = "Die an die Wikidata-Schnittstelle übergebene Item-ID ist nicht gültig.", ["unknown-claim-type"] = "Unbe…
 
KKeine Bearbeitungszusammenfassung
 
Zeile 278: Zeile 278:
if linkTarget then
if linkTarget then
local link = linkTarget
local link = linkTarget
-- if there is a local Wikipedia article linking to it, use the label or the article title
-- if there is a local Helmstedt-Wiki article linking to it, use the label or the article title
if linkName and (linkName ~= linkTarget) then link = link .. "|" .. linkName end
if linkName and (linkName ~= linkTarget) then link = link .. "|" .. linkName end
return "[[" .. link .. "]]"
return "[[" .. link .. "]]"
else
else
-- if there is no local Wikipedia article output the label or link to the Wikidata object to input a proper label
-- if there is no local Helmstedt-Wiki article output the label or link to the Wikidata object to input a proper label
if linkName then return linkName else return "[[:d:" .. id .. "|" .. id .. "]]" end
if linkName then return linkName else return "[[:d:" .. id .. "|" .. id .. "]]" end
end
end
Zeile 647: Zeile 647:
local langcode = frame.args[1]
local langcode = frame.args[1]
local id = frame.args[2]
local id = frame.args[2]
-- return description of a Wikidata entity in the given language or the default language of this Wikipedia site
-- return description of a Wikidata entity in the given language or the default language of this Helmstedt-Wiki site
local entity = mw.wikibase.getEntity(id)
local entity = mw.wikibase.getEntity(id)
if entity and entity.descriptions then
if entity and entity.descriptions then
Zeile 660: Zeile 660:
local langcode = frame.args[1]
local langcode = frame.args[1]
local id = frame.args[2]
local id = frame.args[2]
-- return label of a Wikidata entity in the given language or the default language of this Wikipedia site
-- return label of a Wikidata entity in the given language or the default language of this Helmstedt-Wiki site
local entity = mw.wikibase.getEntity(id)
local entity = mw.wikibase.getEntity(id)
if entity and entity.labels then
if entity and entity.labels then
Zeile 880: Zeile 880:
local id = frame.args[1]
local id = frame.args[1]
-- returns the label of the given entity/property id
-- returns the label of the given entity/property id
-- if no id is given, the one from the entity associated with the calling Wikipedia article is used
-- if no id is given, the one from the entity associated with the calling Helmstedt-Wiki article is used
if not id then
if not id then
local entity = mw.wikibase.getEntity()
local entity = mw.wikibase.getEntity()
Zeile 892: Zeile 892:
local id = frame.args[1]
local id = frame.args[1]
local site = frame.args[2]
local site = frame.args[2]
-- returns the Wikipedia article name of the given entity
-- returns the Helmstedt-Wiki article name of the given entity
-- if no id is given, the one from the entity associated with the calling Wikipedia article is used
-- if no id is given, the one from the entity associated with the calling Helmstedt-Wiki article is used
if not id then
if not id then
local entity = mw.wikibase.getEntity()
local entity = mw.wikibase.getEntity()