模組: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)