Modul:WikidataDescription
-- Simple wrapper for mw.wikibase.description
local p = {}
function p._fromQID(qid, prefix)
local prefix = prefix or ''
local result, lang = mw.wikibase.getDescriptionWithLang(qid)
-- don't get english fallback results
-- if result and string.sub(lang,0,2) == 'id' then
return lang .. prefix -- .. result
-- else
-- return ''
-- end
end
function p.fromQID(frame)
return p._fromQID(frame.args[1], frame.args[2])
end
-- contoh
-- {{#Invoke:WikidataDescription|fromTitle|reelin}} => "protein" (dari https://www.wikidata.org/wiki/Q13561329)
-- {{#Invoke:WikidataDescription|fromTitle|RELN|,}} => "gen pengkode-protein pada manusia" (dari https://www.wikidata.org/wiki/Q414043)
function p.fromTitle(frame)
return p._fromQID(mw.wikibase.getEntityIdForTitle(frame.args[1]), frame.args[2])
end
return p