Template:xlit
- The following documentation is located at Template:xlit/documentation. [edit]
- Useful links: subpage list • links • redirects • transclusions • errors (parser/module) • sandbox (diff)
This template is used to automatically generate a transliteration of some text. It should only be used for testing purposes or as part of templates, not directly in entries.
If you are considering using it in a template, please consider that there is almost certainly a better way to achieve the same effect. Most of the time, transliterations are accompanied by a link to a term, and in that case {{l}}
will already provide a transliteration, so this template is unnecessary. Similarly, headword templates use {{head}}
, which also generates a transliteration automatically.
This template is only meant to transliterate into Latin script. It will produce no transliteration if the text is in Latin script (or another script that is marked with translit = false
in Module:scripts/data) and the language has that script in its language data (value 4
in the data tables in modules such as Module:languages/data/2). This is because it calls the transliterate
method from Module:languages, which in turn may call a tr
function, if a transliteration is needed. It chooses the tr
function from the transliteration module specified in |module=
or selects the appropriate module from the language data based on the Latin and script. This behavior matches the link templates, such as {{m}}
, which do not transliterate if the script is recognized as Latin.
Parameters
|1=
(required)- The language code (Wiktionary:Languages) of the language to transliterate for. The language must have a transliteration module (
translit_module
property in the Module:languages data). If the language has no transliteration module, the template gives an empty string. |2=
(required)- The text to transliterate, which should be written in the given language.
|sc=
(optional)- The script code (Wiktionary:Scripts), which specifies the script to transliterate from. This is almost always unnecessary, as it is usually possible to detect it automatically.
|module=
(optional)- Overrides the module that should be used for transliterations. This is useful for testing purposes, or for demonstrating a transliteration module before it is used. It should not be used in templates intended for real use.
TemplateData
TemplateData for xlit
Automatically generate a transliteration of some text.
Parameter | Description | Type | Status | |
---|---|---|---|---|
Language | 1 | The language code of the language to transliterate for. | String | required |
Text | 2 | The text to transliterate, which should be written in the given language. | Line | required |
Script | sc | The script code, which specifies the script to transliterate from. This is specific to the transliteration module; some are able to transliterate more than one script, and need this parameter to tell it which. For most cases, this can be left empty. | String | optional |