跳转到内容

Template:Label data documentation

維基詞典,自由的多語言詞典
以下文檔{{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)