Module:Wikidata label/doc

From Hârn
Jump to navigation Jump to search

This is the documentation page for Module:Wikidata label

This module returns a link to the Wikipedia article in a chosen language from a Wikidata entity ID. The text of the link will be the Wikidata label in that language.

For the use in wikitext, see {{Label}}.

Documentation[edit source]

_getLabel[edit source]

_getLabel( item, [ lang] , [ link_type] , [ capitalization ] )

You must provide item that must be a valid Wikidata entity Q-code. An example of Q-code is Q47674.

As default is assumed the user language, or lang if specified. An example of language is en.

As default the links points to Wikipedia. To change the project, change link_type. Accepted values: wikidata, commons or - for no links.

Examples[edit source]

In order to have this label in a variable:

Lua error in Module:Wikidata_label at line 62: attempt to index field 'wikibase' (a nil value).

This is the source code:

require wikidata_label = require('Module:Wikidata label')._getLabel

local label = wikidata_label('Q1')