Module:labels/data/doc
This is the documentation page for Module:labels/data
This module contains the data used by Module:labels and, by extension, the templates {{lb}}
and {{tlb}}
. It lists all recognised labels, except the many in the submodules, along with other information.
The following are two of several submodules that exist:
The regional and topical labels are all available through {{lb}}
. In addition, there are language-specific labels; the full list of these submodules can be found here. Language-specific labels override other ones.
Each language data module exports a single table containing labels and/or aliases. The keys of these tables are label identifiers (passed to the templates), while the values are described below.
Labels
[jhyuk]labels
contains most data associated with the actual labels.
The following values are supported:
display
- The wikitext to display for the label. If this is omitted, the displayed text will default to the label's identifier.
glossary
- The anchor in Appendix:Glossary to link to.
glossary = true
means that the anchor is identical to the label. Wikipedia
- The article in English Wikipedia to link to.
Wikipedia = true
means that the article's title is identical to the label. - For
glossary
andWikipedia
, the link text will be identical to the label. To show different link text, change the text of the label (while addingaliases["<old_label>"] = "<new_label>"
), or add a piped link todisplay
. plain_categories
- A string specifying the category that this label should add to the page, or a list of such categories. The value
true
can be used if the category is the same as the label (the first character of the label will be uppercased automatically). The categories are not adjusted depending on the language; they will be taken verbatim, and entries in all languages will be added to the same category. As this is generally undesirable, theplain_categories
value should only be used when a label would only ever be used for a single language. For example, the labelE number
setsplain_categories = "European food additive numbers"
, and the labelCockney rhyming slang
setsplain_categories = true
. It is preferable to usetrue
or a single string if possible (instead of a single-element list), to save memory. topical_categories
- A string specifying the language-dependent topical category that this label should add to the page, or a list of such categories. These categories are of the form
[language code]:[category name]
, e.g. if the labeldisease
specifiestopical_categories = "Diseases"
, an English entry using this label will be added to Category:en:Diseases. The valuetrue
can be used if the category is the same as the label (the first character of the label will be uppercased automatically). For example,physics
specifiestopical_categories = true
, meaning that e.g. a French entry using this label will be added to Category:fr:Physics. It is preferable to usetrue
or a single string if possible (instead of a single-element list), to save memory. pos_categories
- A string specifying the language-dependent part-of-speech-like category that this label should add to the page, or a list of such categories. These categories are of the form
[language name] [category name]
, e.g. if the labelacronym
specifiespos_categories = "acronyms"
, an English entry using this label will be added to Category:English acronyms. The valuetrue
can be used if the category is the same as the label. For example,back slang
specifiespos_categories = true
, meaning that e.g. a French entry using this label will be added to Category:French back slang. It is preferable to usetrue
or a single string if possible (instead of a single-element list), to save memory. sense_categories
- A string specifying the sense-dependent category that this label should add to the page, or a list of such categories. These categories are of the form
[language name] terms with [category name] senses
(when using{{lb}}
) or[language name] [category name] terms
(when using{{tlb}}
). For example, if the labelvery rare
specifiessense_categories = "rare"
, an English entry using this label will be added to Category:English terms with rare senses (if{{lb}}
is used) or Category:English rare terms (if{{tlb}}
is used). The valuetrue
can be used if the category is the same as the label. For example,archaic
specifiessense_categories = true
, meaning that e.g. a French entry using this label will be added to Category:French terms with archaic senses (if{{lb}}
is used) or Category:French archaic terms (if{{tlb}}
is used). It is preferable to usetrue
or a single string if possible (instead of a single-element list), to save memory. regional_categories
- A string specifying the language-dependent regional/dialect category that this label should add to the page, or a list of such categories. These categories are of the form
[category name] [language name]
, e.g. if the labelAlgeria
specifiesregional_categories = "Algerian"
, a French entry using this label will be added to Category:Algerian French. The valuetrue
can be used if the category is the same as the label (the first character of the label will be uppercased automatically). For example,regional
specifiesregional_categories = true
, meaning that e.g. an English entry using this label will be added to Category:Regional English. It is preferable to usetrue
or a single string if possible (instead of a single-element list), to save memory. deprecated
- Marks the label as deprecated if the value is set to true. When a deprecated label identifier is used, the label is wrapped in
<span class="deprecated-label"></span>
and the page is added to Category:Entries with deprecated labels.
Aliases
[jhyuk]Aliases work like redirects to proper labels. When a label is defined here, it "behaves" as if it were the label it "redirects" to. For example, if "American"
is listed as an alias of "US"
, then whenever the label "American"
is used in an entry, it's treated as if the label "US"
had been used in its place.
{{label|en|US}} |
→ | (US) |
{{label|en|American}} |
→ | (US) |
The label that an alias points to does not have to be defined in the list itself. So if you want to make "American"
an alias of "US"
, but do not create a full label for "US"
, that works too.
Double aliases (an alias of another alias) are not supported, and will cause a script error if used.
For a single alias, you can use:
labels["<alternative label>"] = "<label with data table>"
For a list of aliases, you can use:
alias("<label with data table>", {"<alternative label 1>", "<alternative label 2>", ... "<alternative label n>"})
To mark an alias (but not the label it points to) as deprecated, some more involved syntax is required:
labels["<alternative label>"] = { alias_of = "<label with data table>", deprecated = true }