Template:Translate/doc: Difference between revisions
m link to lua module |
m →Lua: typo, module name is Dictionary |
||
Line 50: | Line 50: | ||
=Lua= | =Lua= | ||
This template simply forwards parameters to the Lua function <code>translate</code> from [[Module: | This template simply forwards parameters to the Lua function <code>translate</code> from [[Module:Dictionary]]. If familiar with Lua invokes, try using it or <code>translate_embed</code> instead. | ||
=Parameters= | =Parameters= |
Revision as of 21:51, 12 October 2024
How to help translate
Navigate to Data:Dictionary and add the translations for a specific key there. For example, to translate 'Patch notes' to spanish (es), edit the record in the Dictionary from
"Patch notes": { "en": "Patch notes", "ru": "Содержание обновления" }
to
"Patch notes": { "en": "Patch notes", "ru": "Содержание обновления", "es": "Notas de revision" }
Similarly, if translating a new key not yet added, simply add the record that looks like the above at the bottom of the page, but be sure the last curly brace } has a comma afterwards.
When to use
This should only be used to translate text written in Templates, such as Template:Update layout which outputs "Patch notes" above the UI element. Page specific content should be translated on that page in that language, i.e. /Abrams/es or /Abrams/en
Example
Without providing lang_override, the language will be detected based on the subpage the user is on, i.e. /Abrams/es will be detected as a spanish page.
{{Translate|Patch notes}}
Outputs
Patch notes
{{Translate|Patch notes|ru}}
Outputs
Содержание обновления
If translation to that language does not yet exist, it will default to the english translation. If the english translation also does not exist, it will default to the provided key. In both cases, it will add {{NeedsTranslationTooltip}}
at the end to guide users to help translate it, appearing as [nt].
{{Translate|Patch notes|made-up-code}}
Outputs
Patch notes[nt]
Lua
This template simply forwards parameters to the Lua function translate
from Module:Dictionary. If familiar with Lua invokes, try using it or translate_embed
instead.
Parameters
A template to fetch translations for a given key, optionally overriding the language.
Parameter | Description | Type | Status | |
---|---|---|---|---|
key_to_translate | 1 | The key that corresponds to the text to be translated.
| String | required |
lang_override | 2 | Optional two-letter language code to override the language (e.g., 'en', 'es'), if page ends in /<lang_code> it defaults to that lang code.
| String | optional |