Modul:Wikidata/Formatters/wikibase-entityid
Vzhled
require 'Modul:No globals'
local p = {}
-- TODO: move to ../i18n
local i18n = {
['missing-label'] = 'Položka na Wikidatech neobsahuje český štítek; můžete ho doplnit'
}
function p.getLinkWhenNonexistingLabel(entityId)
local Functions = require 'Modul:Functions'
return '[[Soubor:Wikidata-edit.svg|27x17px|link=d:' .. entityId .. '|' .. i18n['missing-label'] .. ']]'
.. '<code>[[d:' .. entityId .. '|' .. entityId .. ']]</code>'
.. Functions.maintenanceCat('Doplnit štítek na Wikidatech')
end
function p.formatEntityId(entityId, options)
local label = mw.wikibase.label(entityId)
local link = mw.wikibase.sitelink(entityId)
if link then
if label then
return '[[' .. link .. '|' .. label .. ']]'
else
return '[[' .. link .. ']]'
end
elseif label then
return label
else
return p.getLinkWhenNonexistingLabel(entityId)
end
end
return p