Template:Translation: Difference between revisions

From Heroes of Might and Magic: Olden Era Official Wiki
No edit summary
No edit summary
Line 6: Line 6:
     T.target_id = "{{{1}}}"
     T.target_id = "{{{1}}}"
     AND T.language = "{{{2|en}}}"
     AND T.language = "{{{2|en}}}"
    {{#if:{{{type|}}}|AND T.type="{{{type}}}"|}}
| fields =
| fields =
     T.name
     T.name
Line 51: Line 52:


{{Color|lime|Output:}} Hello{{Translation|nature|en}}World
{{Color|lime|Output:}} Hello{{Translation|nature|en}}World
----
5. With {{b|type}}, when collisions are a concern:
{{Color|yellow|Input:}} <code><nowiki>{{Translation|luck|en|type=unit_stat}}</nowiki></code>
{{Color|lime|Output:}} {{Translation|luck|en|type=unit_stat}}


</noinclude>
</noinclude>

Revision as of 09:23, 15 July 2026


Retrieves the name value from the Translation Cargo table for a target id, in the desired language.

This is very similar to the Label template, but is more generic, allowing you to pull any id from the Translation table, not just those prefixed with wiki_.

Usage

1. English:

Input: {{Translation|nature|en}}

Output: Grove


2. Japanese:

Input: {{Translation|nature|ja}}

Output: グローヴ


3. Missing id:

Input: {{Translation|foo|en}}

Output: —


4. Surrounded by text, to prove this template doesn't add unexpected whitespace:

Input: Hello{{Translation|nature|en}}World

Output: HelloGroveWorld


5. With type, when collisions are a concern:

Input: {{Translation|luck|en|type=unit_stat}}

Output: Luck