Template:Translate/doc: Difference between revisions

From The Deadlock Wiki
Jump to navigation Jump to search
Sur (talk | contribs)
m how to help translate
rewrite documentation for clarity
 
(13 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]].


=Example=
=== Examples ===
<pre style="width: fit-content">{{Translate|Patch notes}}</pre>


Outputs
<code><nowiki>{{Translate|Patch notes}}</nowiki></code> Output: {{Translate|Patch notes}}


{{Translate|Patch notes}}
<code><nowiki>{{Translate|Patch notes|lang_code=ru}}</nowiki></code> Output: {{Translate|Patch notes|lang_code=ru}}


 
<templatedata>
<pre style="width: fit-content">{{Translate|Patch notes|ru}}</pre>
{
 
"description": " ",
Outputs
"params": {
 
"1": {
{{Translate|Patch notes|ru}}
"label": "Dictionary key",
 
"description": "The key that corresponds to the text to be translated.",
=Parameters=
"type": "string",
 
"required": true,
<templatedata>{
"example": "Patch notes"
    "description": "A template to fetch translations for a given key, optionally overriding the language.",
},
    "params": {
"lang_code": {
        "1": {
"label": "Language code",
            "label": "key_to_translate",
"description": "Optional language code to override the language. See Data:LangCodes.json.",
            "description": "The key that corresponds to the text to be translated.",
"example": "es, cs, pt-br",
            "type": "string",
"type": "string"
            "required": true,
}
            "example": "Patch notes"
},
        },
"paramOrder": [
        "2": {
"1",
            "label": "lang_override",
"lang_code"
            "description": "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.",
],
            "type": "string",
"format": "inline"
            "required": false,
            "example": "es",
            "default": ""
        }
    }
}</templatedata>
}</templatedata>
<includeonly>[[Category:Language templates]]</includeonly><noinclude>[[Category:Template documentation]]</noinclude>

Latest revision as of 20:45, 6 June 2026

Overview

[edit source]

Navigate to Data:Dictionary to add or update keys, or create a new key if one does not already exist.

For additional context about where a key is used, see Data:Dictionary/sources.

Tooltip notes

[edit source]
  • {{NeedsTranslationTooltip}} [nt] - displayed when the key is not translated.
  • {{MissingValveTranslationTooltip}} [vt] (manual) - displayed in cases where an official translation is expected but unavailable.

Use this template to translate reusable text strings and interface text that appear in templates, such as {{Update layout}}. Page-specific content should be translated on the corresponding language subpage.

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.

See also: Module:Dictionary.

Examples

[edit source]

{{Translate|Patch notes}} Output: Patch notes

{{Translate|Patch notes|lang_code=ru}} Output: Содержание обновления

Template parameters

This template prefers inline formatting of parameters.

ParameterDescriptionTypeStatus
Dictionary key1

The key that corresponds to the text to be translated.

Example
Patch notes
Stringrequired
Language codelang_code

Optional language code to override the language. See Data:LangCodes.json.

Example
es, cs, pt-br
Stringoptional