|
|
| (5 intermediate revisions by 2 users not shown) |
| Line 1: |
Line 1: |
| =How to help translate= | | = Overview = |
| 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 | | Navigate to [[Data:Dictionary]] to add or update keys, or create a new key if one does not already exist. |
|
| |
|
| <pre>
| | For additional context about where a key is used, see [[Data:Dictionary/sources]]. |
| "Patch notes": {
| |
| "en": "Patch notes",
| |
| "ru": "Содержание обновления"
| |
| }
| |
| </pre>
| |
|
| |
|
| to
| | == Tooltip notes == |
| | * '''{{tl|NeedsTranslationTooltip}}''' {{NeedsTranslationTooltip}} - displayed when the key is not translated. |
| | * '''{{tl|MissingValveTranslationTooltip}}''' {{MissingValveTranslationTooltip}} (manual) - displayed in cases where an official translation is expected but unavailable. |
|
| |
|
| <pre>
| | == Usage == |
| "Patch notes": {
| | Use this template to translate reusable text strings and interface text that appear in templates, such as {{tl|Update layout}}. Page-specific content should be translated on the corresponding language subpage. |
| "en": "Patch notes",
| |
| "ru": "Содержание обновления",
| |
| "es": "Notas de revision"
| |
| }
| |
| </pre>
| |
|
| |
|
| | If a translation is unavailable, the template falls back to the english translation and displays the missing translation tooltip. An optional parameter allows the language to be overridden. |
|
| |
|
| 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.
| | See also: [[Module:Dictionary]]. |
|
| |
|
| =When to use= | | === Examples === |
| 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=
| | <code><nowiki>{{Translate|Patch notes}}</nowiki></code> Output: {{Translate|Patch notes}} |
| 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.
| |
| <pre style="width: fit-content">{{Translate|Patch notes}}</pre> | |
|
| |
|
| Outputs
| | <code><nowiki>{{Translate|Patch notes|lang_code=ru}}</nowiki></code> Output: {{Translate|Patch notes|lang_code=ru}} |
|
| |
|
| {{Translate|Patch notes}}
| | <templatedata> |
| | | { |
| | | "description": " ", |
| <pre style="width: fit-content">{{Translate|Patch notes|ru}}</pre> | | "params": { |
| | | "1": { |
| Outputs
| | "label": "Dictionary key", |
| | | "description": "The key that corresponds to the text to be translated.", |
| {{Translate|Patch notes|ru}}
| | "type": "string", |
| | | "required": true, |
| | | "example": "Patch notes" |
| 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 <code><nowiki>{{NeedsTranslationTooltip}}</nowiki></code> at the end to guide users to help translate it, appearing as {{NeedsTranslationTooltip}}.
| | }, |
| | | "lang_code": { |
| <pre style="width: fit-content">{{Translate|Patch notes|made-up-code}}</pre>
| | "label": "Language code", |
| | | "description": "Optional language code to override the language. See Data:LangCodes.json.", |
| Outputs
| | "example": "es, cs, pt-br", |
| | | "type": "string" |
| {{Translate|Patch notes|made-up-code}}
| | } |
| | | }, |
| =Lua=
| | "paramOrder": [ |
| 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.
| | "1", |
| | | "lang_code" |
| =Parameters=
| | ], |
| | | "format": "inline" |
| <templatedata>{
| |
| "description": "A template to fetch translations for a given key, optionally overriding the language.",
| |
| "params": {
| |
| "1": {
| |
| "label": "key_to_translate",
| |
| "description": "The key that corresponds to the text to be translated.",
| |
| "type": "string",
| |
| "required": true,
| |
| "example": "Patch notes"
| |
| },
| |
| "2": {
| |
| "label": "lang_override",
| |
| "description": "Optional language code to override the language (e.g., 'en', 'es'), if page ends in /<lang_code> it defaults to that lang code. See accepted language codes at [[Data:LangCodes]]",
| |
| "type": "string",
| |
| "required": false,
| |
| "example": "es",
| |
| "default": ""
| |
| }
| |
| }
| |
| }</templatedata> | | }</templatedata> |
| | <includeonly>[[Category:Language templates]]</includeonly><noinclude>[[Category:Template documentation]]</noinclude> |