Template:Language data documentation

This module contains definitions and metadata for. See Languages for more information.

This module must not be used directly in other modules or templates. The data should be accessed through Module:languages.

Required values
Every entry in the table must contain the following indexed fields:


 * The "canonical" name of the language. This is the name that is used in Wiktionary entries and category names.
 * The "canonical" name of the language. This is the name that is used in Wiktionary entries and category names.


 * The Wikidata item id (Q number) for the language. Set to  if not known/present. This replaces the older   property, which can still be used to link to specific sections or language editions.
 * The Wikidata item id (Q number) for the language. Set to  if not known/present. This replaces the older   property, which can still be used to link to specific sections or language editions.

Optional values

 * The code for the family that the language belongs to. See Families.
 * The code for the family that the language belongs to. See Families.

The properties lua and lua are used for text substitution; they replace or remove certain characters or sets of characters. They both work similarly, and are optional. They can both be tables, and lua can be the name of a module that takes an entry name and generates a sortkey (which is used to sort the entry on category pages).

if lua is the name of a module (for instance, lua referring to Module:zh-sortkey), the module must contain a sortkey-generating function that is named lua. This function must take the arguments lua, where lua is the page name (or other text in the language), lua is the language code (not the language object), and lua 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 lua function.

If lua or lua is a table, it should have the values lua and lua, or lua, or both. lua is paired with lua, and both of them must be tables that are organised pairwise: each element in lua is a pattern to identify which characters in the term to replace, while the corresponding element in lua defines what to replace them with (as an argument to lua).

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

lua and lua can also contain a string lua, which contains characters that will be removed after the text is decomposed. For instance, if lua is a combining acute accent, all acute accents will be stripped, even if they are part of precomposed characters (like á or ).

The tables can contain literal characters, or the patterns (a type of regular expressions) that are used by the standard Scribunto lua 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).


 * 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 ( &rarr;  ), or macrons from Latin or Old English words (  &rarr;  ), as these are not used in the normal written form of these languages. This is used by   in Module:languages.
 * 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 ( &rarr;  ), or macrons from Latin or Old English words (  &rarr;  ), as these are not used in the normal written form of these languages. This is used by   in Module:languages.


 * 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  in Module:languages.
 * 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  in Module:languages.

These are other optional values:
 * A list of aliases/synonyms for the language, other than the canonical name.
 * A list of aliases/synonyms for the language, other than the canonical name.


 * A table of language varieties that are subsumed under the language. This should not in general include those language varieties for which separate etymology language codes have been assigned (e.g. Late Latin, Vulgar Latin and Medieval Latin for Latin; Auvergnat, Gascon, Lengadocian, Limousin, Provençal and Vivaro-Alpine for Occitan). If a given variety has several names, they can all be listed by including a sublist in the overall list, where the first element is the canonical name that you want the variety to be known by, and the remainder are aliases. For example, Azerbaijani lists the following under varieties: Here, the Afshar variety has three aliases specified (Afshari, Afshar Azerbaijani, and Afchar) while the Qashqa'i variety has two aliases specified (Qashqai and Kashkay), and the Songor, North Azerbaijani and South Azerbaijani varieties have no aliases listed. Note that, as here, varieties at different levels of specificity can be given in the same list. In some cases varieties should instead be added to Module:etymology languages/data, with the language as the   value, so that they can be referred to in etymologies.
 * (deprecated)
 * A table of all non-canonical names that this language is known by, including both synonyms and language varieties. This should not be used in new languages, and existing languages should have the entries in this list moved into either  or.
 * A table of all non-canonical names that this language is known by, including both synonyms and language varieties. This should not be used in new languages, and existing languages should have the entries in this list moved into either  or.


 * The type of language (which affects how it is handled on Wiktionary). Possible values are:
 * - This value is the default, so it doesn't need to be specified. It indicates that the is attested according to WT:CFI and therefore permitted in the main namespace. There may also be reconstructed terms for the language, which are placed in the Reconstruction namespace and must be prefixed with * to indicate a reconstruction.
 * - This language is not attested according to CFI, and therefore is allowed only in the Reconstruction namespace. All terms in this language are reconstructed, and must be prefixed with *.
 * - This language is attested but does not meet the additional requirements set out for constructed languages (WT:CFI). Its entries must therefore be in the Appendix namespace, but they are not reconstructed and therefore should not have * prefixed in links.
 * - This language is attested but does not meet the additional requirements set out for constructed languages (WT:CFI). Its entries must therefore be in the Appendix namespace, but they are not reconstructed and therefore should not have * prefixed in links.


 * A list of script codes, see 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 lua 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.
 * Many templates and modules detect the script of text in a particular language using the lua 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.


 * The name of a module that is used to generate transliterations of terms, without the Module: prefix. This module must export a function named  that is defined as follows:
 * 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.
 * 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.
 * 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.


 * A table listing the language codes of the direct ancestors of this language. For example, the ancestor of English is listed as  (Middle English);   (Old English, the ancestor of Middle English),   (Proto-Germanic, the ancestor of Old English), and   (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 belongs to the Indo-European  family, and its direct ancestor is Proto-Indo-European . Because Proto-Indo-European is the proto-language of the Indo-European languages, Proto-Germanic does not need an   table; Proto-Indo-European will be automatically returned as its ancestor by the lua function.
 * 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 belongs to the Indo-European  family, and its direct ancestor is Proto-Indo-European . Because Proto-Indo-European is the proto-language of the Indo-European languages, Proto-Germanic does not need an   table; Proto-Indo-European will be automatically returned as its ancestor by the lua function.


 * 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.
 * 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.


 * The name of the Wikipedia article for the language. Should normally only be supplied if the Wikidata id cannot be used.
 * The name of the Wikipedia article for the language. Should normally only be supplied if the Wikidata id cannot be used.