Module:Dictionary/doc

From Deadlock Wiki
Revision as of 22:05, 12 October 2024 by Sur (talk | contribs) (initial)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

This is the documentation page for Module:Dictionary

Overview

See Template:Translate for how/when to use and more documentation.

Functions

translate

Translates a given key using Data:Dictionary.

Parameters

  • key - key to translate
  • lang_code_override (OPTIONL) - language code that overrides current language. See supported list at Data:LangCodes.

Example

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

Outputs

Update history


translate_embed

Translates a given key then replaces %s in the string with extra parameters

Parameters

  • key - key to translate
  • var1 - first variable to embed in the string
  • var2 - second
  • varN - Nth

Ensure the number of variables passed matches the number of instances of %s in the translated string.

Examples

Without embedment: {{#invoke:Dictionary|translate|TranscludedNotesFrom}}

Outputs

Key 'TranscludedNotesFrom' is not in Data:Dictionary

With embedment:

{{#invoke:Dictionary|translate_embed
|1=TranscludedNotesFrom
|2=https://en.wikipedia.org/wiki/Help:Transclusion
|3=[[Source_Page/notes]]
|4=https://deadlocked.wiki/index.php?title=Source_Page/notes&action=edit
}}

Outputs

Key 'TranscludedNotesFrom' is not in Data:Dictionary

Notes

  • The parameters do not need to be prefixed with "1=", "2=", etc., they are used in the above example because the 4th parameter contains an equal sign (=) in it, where it would be read as a named parameter rather than a ordinal parameter.
  • Ensure the number of passed variables (other than the key) matches the number of %s used in the translated string.