模组:Languages/data/3/y/doc

这是Module:Languages/data/3/y的文档页面

在"incategory ..."过滤器后添加搜索文字:

该模块包含了语言代码之定义和元数据。欲见其他相关资讯,请参见附录:语言列表

此模块不得直接用于其他模块或模板。资料与数据应通过Module:languages获取。

必填值

编辑

表中的每个项目必须包含以下索引字段:

1
该语言的“规范”名称,旧版模块中写作canonicalName。这是维基词典词条和分类名称中使用的名字。
2
该语言在维基数据的ID(以Q开头)。这取代了旧的wikipedia_article属性。若该语言在维基数据没有对应的实体,可将其设为nil

选填值

编辑
3
该语言所属的语系,请参见Wiktionary:语系

属性 entry_namesort_key 用于替换文本;它们替换或删除某些字符或字符集。其工作原理相似,且都是可选的。它们都可以是表,sort_key 可以是一个模块的名称,该模块接收一个条目名并生成一个排序键(用于在类别页面上对条目进行排序)。

if sort_key is the name of a module, the module must contain a sortkey-generating function that is named makeSortKey. This function must take the arguments text, lang, sc, where text is the page name (or other text in the language), lang is the language code (not the language object), and sc is the script code (not the script object). The returned value should always be a string, or there will be a module error in the Language:makeSortKey() function.

If either one is a table, it must contain two tables inside it: one named from and one named to. These two tables are organised pairwise: each element in from is a pattern to identify which characters in the term to replace, while the corresponding element in to defines what to replace them with.

If the replacement is not present or if it is false or nil, it defaults to an empty replacement, meaning that the matching characters are removed altogether. This means that the from list can be longer than the to list, and an empty replacement will be assumed for any elements in from that have no counterpart in to.

The tables can contain literal characters, or the patterns (a type of regular expressions) that are used by the standard Scribunto mw.ustring.gsub function. See the Scribunto reference manual for more information.

At the top of the module, there is a list of combining characters with names. These are provided for convenience and readability, as combining characters generally do not display properly inside the module code (although they do not affect the actual operation of the module).

entry_name
Defines replacements to create the entry name from the displayed form of a term. This can be used to remove certain diacritical marks according to the customs or standard practice of the language. For example, it is used to remove accent marks from Russian words (ру́сскийрусский), or macrons from Latin or Old English words (ōsos), as these are not used in the normal written form of these languages. This is used by makeEntryName in Module:languages.
sort_key
Defines replacements to create a category sort key from the page name. The purpose is to remove any characters that are ignored in sorting, and to replace similar characters with identical ones if the sorting rules for that language do not distinguish them. For example, in German, the characters "ä" and "a" are considered equivalent for sorting, and are both treated as "a". The page name is converted to lowercase before applying the replacements, so you should not add uppercase letters to the "from" lists. This is used by makeSortKey in Module:languages.

These are other optional values:

otherNames
该语言除了标准名称外的所有名称的表格。该表格不仅应包括该语言的同义词,而且应包括指归入同一类别的语言变体的名称。例如,虽然佛兰芒语不是荷兰语的同义词,但佛兰芒语被认为是荷兰语的“一部分”,因此该名称被列入荷兰语其中。
type
语言的类型(会影响它在Wiktionary上的处理方式)。可用的值包括:
  • regular-这个值是默认值,所以不需要特别指定。这表示该语言的词汇符合Wiktionary:收录标准,因此被允许放在主命名空间中。该语言可能也有重构的词汇,则这些词汇应被放在重构(Reconstructed)命名空间中,且必须在前面加“*”表示重构。(注:中文维基词典暂无 Reconstructed 空间。)
  • reconstructed - 此语言不符合Wiktionary:收录标准,因此只允许在重构命名空间中使用。这类语言中的所有词汇都是重建得到的,必须在前面加上“*”。
  • appendix-constructed - 这种语言已经通过验证,但不符合对重构语言的额外要求(Wiktionary:收录标准#构建语言)。因此,其词汇必须放在附录(Appendix)命名空间中;又因为它们不是透过重建得到的,因此不应该在链接中加上“*”前缀。
scripts
A list of script codes, see Wiktionary:Scripts. These represent all the scripts (writing systems) that this language uses in the real world, as well as the ones that Wiktionary uses. The scripts that are used most often on Wiktionary should be first in the list, as this will speed up script detection.
Many templates and modules detect the script of text in a particular language using the findBestScript function in Module:scripts. This function goes down the list of scripts and counts how many characters in the text belong to each script. If all the characters belong to one script, that script will be returned; otherwise, the script with the most characters will be returned. Thus, script detection will be faster if the most frequently used scripts are first in the list.
translit_module
The name of a module that is used to generate transliterations of terms, without the Module: prefix. This module must export a function named tr that is defined as follows:
tr(text, lang, sc)
The three parameters are the text to be transliterated, the language code, and the script code. The function can ignore the language and script codes, but they are provided for cases when a language has more than one script, or when a single function is used to transliterate multiple languages sharing the same script.
ancestors
A table listing the language codes of the direct ancestors of this language. For example, the ancestor of English is listed as enm (Middle English); ang (Old English, the ancestor of Middle English), gem-pro (Proto-Germanic, the ancestor of Old English), and ine-pro (Proto-Indo-European, the ancestor of Proto-Germanic) are not listed.
For most languages, only one ancestor code should be given, but multiple ancestors can be listed for pidgins, creoles and mixed languages.
The ancestor language table should not be included if the language's direct ancestor is the proto-language of the family to which the language belongs. In such a case, if the family code has been provided, Module:languages will automatically add the proto-language as the language's ancestor. For example, Proto-Germanic (gem-pro) belongs to the Indo-European (ine) family, and its direct ancestor is Proto-Indo-European (ine-pro). Because Proto-Indo-European is the proto-language of the Indo-European languages, Proto-Germanic does not need an ancestors table; Proto-Indo-European will be automatically returned as its ancestor by the getAncestors function.
wikimedia_codes
A table listing the Wikimedia language codes that this language maps to. This is used to translate Wiktionary codes to Wikimedia codes, which are usually the same but there are a few languages where it is different. The language codes must be valid Wikimedia codes (as determined by the wiki software), and if they are not defined in one of the language data modules, they must be defined in Module:wikimedia languages/data.
wikipedia_article
The name of the Wikipedia article for the language. Should normally only be supplied if the Wikidata id cannot be used.