Module:Wikidata label/doc
Jump to navigation
Jump to search
This is the documentation page for Module:Wikidata label
This module is rated as ready for general use. It has reached a mature form and is thought to be bug-free and ready for use wherever appropriate. It is ready to mention on help pages and other Starfleet resources as an option for new users to learn. To reduce server load and bad output, it should be improved by sandbox testing rather than repeated trial-and-error editing. |
This module is subject to page protection. It is a highly visible module in use by a very large number of pages, or is substituted very frequently. Because vandalism or mistakes would affect many pages, and even trivial editing might cause substantial load on the servers, it is protected from editing. |
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')