Template:Translate/doc: Difference between revisions

Sur (talk | contribs)
documentation initial
 
rewrite documentation for clarity
 
(14 intermediate revisions by 2 users not shown)
Line 1: Line 1:
=Example=
= Overview =
<pre style="width: fit-content">{{Translate|Patch notes}}</pre>
Navigate to [[Data:Dictionary]] to add or update keys, or create a new key if one does not already exist.


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


{{Translate|Patch notes}}
== 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.


== Usage ==
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.


<pre style="width: fit-content">{{Translate|Patch notes|ru}}</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.


Outputs
See also: [[Module:Dictionary]].


{{Translate|Patch notes|ru}}
=== Examples ===


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


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