Module:Dictionary/doc: Difference between revisions

From The Deadlock Wiki
Jump to navigation Jump to search
m p.translate: clarify this part.
mNo edit summary
 
Line 3: Line 3:


== p.translate ==
== p.translate ==
Translates a given key from [[Data:Dictionary]]. '''Manual invocation should only be used when additional parameters are required''', such as {{tl|Update link}}, where the DISPLAYTITLE is generated using a translation key with expected parameters.
Translates a given key from [[Data:Dictionary]]. '''Manual invocation should only be used when additional parameters are required''', such as {{tl|Update layout}}, where the DISPLAYTITLE is generated using a translation key with expected parameters.


For normal usage, use the basic template.
For normal usage, use the basic template.

Latest revision as of 21:03, 6 June 2026

Overview

[edit source]

See {{Translate}} for how/when to use and more documentation.

p.translate

[edit source]

Translates a given key from Data:Dictionary. Manual invocation should only be used when additional parameters are required, such as {{Update layout}}, where the DISPLAYTITLE is generated using a translation key with expected parameters.

For normal usage, use the basic template.

Function parameters

[edit source]
  • key – translation key (required).
  • Language-specific:
    • lang_code_override (optional, named parameter) – language code overriding the automatic detection. See Data:LangCodes.json.
    • fallback_str (optional, named parameter) – value returned only if translation is missing. If set to empty string or nil, fallback will be empty (useful for detecting missing translations).

Examples

[edit source]

{{#invoke:Dictionary|translate|Update history}} Output: Update history

{{#invoke:Dictionary|translate|Updates|lang_code_override=pt-br}} Output: Atualizações

{{#invoke:Dictionary|translate|Update history|fallback_str=Custom fallback text.}} Output: Custom fallback text.[nt]