跳转到内容

模组:Labels/data/doc

维基词典,自由的多语言词典

这是Module:Labels/data的文档页面

此模组是指定Module:labels(以及扩展的模板{{lb}}{{tlb}})识别的标签的资料模组之一。

以下是所有存在的资料子模组:

模组 内容
Module:labels/data/lang/langcode 特定于某个语言的标签
Module:labels/data 非特定于某个语言的杂项标签。
Module:labels/data/qualifiers 限定词,例如有點主要用於;。这些限定词通常会导致后面和/或前面的逗号被省略。
Module:labels/data/regional 指定多种语言共享的地理位置的标签。
Module:labels/data/topical 人類學道教等主题标签,通常会产生主题分类。

前面列出的模组中定义的标签将覆盖后面列出的模组中的标签。此外,特定于语言的标签会覆盖非特定于语言的标签。可以在此处找到特定于语言的子模组的完整清单。

每个语言资料模组导出一个包含标签和/或别名的表。 这些表的键是标签标识符(传递给模板),而值如下所述。

标签用途[编辑]

标签资料目前有多种用途:

模板 参数 用途 产生分类?
{{lb}}/{{lbl}}/{{label}} and {{tlb}}/{{term-label}} 2=, |3=, ... Label the language variety or usage conditions of a sense or term.
{{alt}}/{{alter}} numbered parameters following a blank parameter Identify the language variety or usage conditions of an alternative form.
{{alternative form of}}/{{alt form}}, {{standard spelling of}}/{{stand sp}}, and other form-of templates from=, |from2=, ... Identify the language variety of a sense or term that is a variant (e.g. alternative form, spelling variant, etc.) of another term.
{{syn}}, {{ant}} and other "nyms" templates lb=, |lb2=, ...; the <lb:...> inline modifier Identify the language variety or usage conditions of a synonym, antonym or the like, specified inline.
{{desc}}/{{descendant}} lb=, |lb2=, ...; the <lb:...> inline modifier Identify the language variety or usage conditions of a descendant.
{{quote-book}}, {{quote-journal}}, {{cite-book}}, {{cite-journal}} and other quotation and citation templates lb= Identify the language variety or usage conditions of a piece of quoted text.
{{inflection of}}/{{infl of}} auto-added under certain combinations of inflection tags Label the usage conditions of an inflected form of a term.
{{indtr}} 2=, |3=, ... following a period/full stop Label the usage conditions of a sense or term, along with the syntactic form taken by a direct or indirect object.
category pages for language varieties N/A Control the display and parent categories of category pages that are "associated" with a label in that the label categorizes into the specified category using the plain_categories or regional_categories fields. N/A

标签资料模组[编辑]

以下文档{{label data documentation}}产生。[edit]

每个资料模组定义并汇出一个称为labels的表,其中包含与实际标签关联的资料。键是标签,而值是包含标签资讯的表。 以下是一个基本范例:

labels["阿根廷"] = {
	aliases = {"Argentina", "Argentinian"},
	Wikipedia = true,
	regional_categories = "阿根廷",
}

这定义了带有别名ArgentinaArgentinian的标签阿根廷,将该标签连结到维基百科的“阿根廷”条目,并让{{lb}}{{tlb}}的得以使用标签来将某个条目放进阿根廷lang的分类中,其中lang是标签的语言。

以下是一个更复杂的范例,用于Module:labels/data/lang/en中:

labels["British"] = {
	region = "Great Britain",
	addl = "Not to be confused with [[:Category:British English forms|British spellings]], a spelling system used in some English-speaking countries of the world.",
	aliases = {"Britain", "Great Britain"},
	Wikipedia = "英國英語",
	regional_categories = true,
	parent = "Europe,Commonwealth",
	country = "the United Kingdom",
}

这定义了一个带有两个别名Britain和{{cd|Great Britain}的标签British,所有别名都显示为British并连结到维基百科条目“英国英语”。与{{lb}}{{tlb}}一起使用,可将该条目加入英式英语的分类中。 栏位regionaddlparentcountry控制类别“英国英语”的分类文字的外观。

下表列出了基本栏位。 有关更多详细信息,请参阅Module:labels/data的文档。

栏位 举例 描述
aliases {"Britain", "Great Britain"} List of aliases for the label.
display "Taraškievica orthography" or "[[alcoholic#Adjective|alcoholic]] [[beverage]]s" How the label displays (if different from the label itself).
Wikipedia "Shopi#Dialects" or true or {"Goan Portuguese", "Portuguese India"} Wikipedia article to link to, or true if the article is named the same as the (canonical form of the) label. Multiple articles can be provided; only the first is used for linking the label, but all are displayed on the label's category page.
Wiktionary "Appendix:Swedish verbs" Wiktionary article to link to, or true if the anchor is named the same as the (canonical form of the) label.
Wikidata "Q2675834" or {"Q98095139", "Q9668261"} Wikidata ID or ID's identifying one or more Wikipedia articles to link to. Multiple ID's can be provided; only the first associated article is used for linking the label, but all are displayed on the label's category page.
glossary "tashif" The anchor in Appendix:Glossary to link to, or true if the anchor is named the same as the (canonical form of the) label.
langs {"la", "lad", "nrf", "vi", "yi"} Language restriction for this label, for labels not occurring in a language-specific module. The label will only be recognized for the specified language code(s).

The following table specifies the fields used to control how the label categorizes when used with {{lb}} or {{tlb}}.

栏位 举例 描述
plain_categories "Multicultural Toronto English" or true or {"American English forms", "Oxford spellings"} Category or categories to add the page to, when {{lb}} or {{tlb}} are used; use true if the category is the same as the (canonical form of the) label.
regional_categories "Algerian" or true or {"Devonian", "Somerset"} Like plain_categories but the language name is appended to the specified value(s).
pos_categories "pluralia tantum" or true or {"transitive verbs", "intransitive verbs"} Like plain_categories but the language name is prepended to the specified value(s).
topical_categories "Football (American)" or true or {"Software engineering", "Programming"} Like plain_categories but the language code is prepended to the capitalized specified value(s).
sense_categories "dated" or true or {"obsolete", "historical"} Categorizes into lang terms with category senses (when using {{lb}}) or {{lang category terms}} (when using {{tlb}}).

下表指定用于控制指定语言变体的标签的类别页面外观(使用plain_categoriesregional_categories指定)的栏位。

栏位 举例 描述
region "the [[United States]]" or "the tri-state region of <country>" or "[[Cajun]]s in {{w|Acadiana|Southern Louisiana}}" Region where the variety specified by the label is used; or the users of the variety, if prep = "by" is given. Defaults to the label. The spec <country> is replaced by the value(s) specified using the country field; see below.
the true Causes the default value for region to have the word the prepended (e.g. for a label such as Philippines or Channel Islands).
prep "by" Preposition used in the category description, after Terms or senses in lang as spoken, in place of in.
verb "originally spoken" or "used" Verb used in the category description, after Terms or senses in lang as, in place of spoken.
def "[[Lunfardo]], a Spanish [[argot]] with origins in [[Buenos Aires]]" Definition text used in the category description, after Terms or senses in. Defaults to lang as spoken in region, where lang is the language and region is the value of the region field.
fulldef "Anglo-Indian terms or senses in English as used formerly by Britishers in {{w|British India}}" Definition text used in the category description. Defaults to Terms or senses in lang as spoken in region; see the def field.
addl "Not to be confused with the {{catlink|Bavarian language}}." Additional text to display on the label's category page.
parent "New England" or true or "Southern US,Southwestern US" Parent label(s). The category corresponding to the label will have the category or categories of the parent label(s) as its parent(s). If true, the parent will be Regional lang, or Varieties of lang if noreg = true is given.
noreg true Specify that this variety is non-regional (not a topolect). Used e.g. with chronolects such as Early Modern English and sociolects such as Katharevousa. Controls the default parent when parent = true is used.
othercat "en:Universities" or "British slang,English cant,English gay slang" Additional category or categories to add the label's category page to. Useful especially for categories not associated with a label.
country "France" or "Belgium,the [[Netherlands]],Germany" Country or countries where this label's variety is spoken. Used in two ways: (1) to add the label's category to pages such as Category:Languages of France or Category:Languages of the Netherlands; (2) to substitute into the <country> spec in the description.

下表指定了其馀栏位,主要用于控制标签的显示方式。

栏位 举例 描述
deprecated true 表示此标签已弃用(不应使用)。 此类标签与 deprecated-label CSS 类别一起显示,并将页面加入到 Category:Entries with deprecated labels中。
deprecated_aliases {"dual"} 指定给定标签的已弃用别名(即不应使用的别名)。使用这种别名会导致标签以 deprecated-label CSS 类别显示,且页面会被加入至 Category:Entries with deprecated labels
track true 1=.
special_display [[Classical <canonical_name>]] Like display but <canonical_name> is replaced with the canonical language name.
omit_preComma true Don't display a comma before the label, for labels like and, by, _ and ;.
omit_postComma true Don't display a comma after the label, for labels like and, by, _, ; and chiefly.
omit_preSpace true Don't display a space before the label, for labels like ; and :.
omit_postSpace true Don't display a comma after the label, for labels like - (hyphen), (en-dash) and (em-dash).

在资料模组的末尾,应使用以下程式码返回labels表:

return require("Module:labels").finalize_data(labels)