Template:Sandbox/Aurelain/Translation: Difference between revisions

From Heroes of Might and Magic: Olden Era Official Wiki
No edit summary
No edit summary
Line 21: Line 21:
|where  = T.target_id = '{{{1}}}' AND T.language='{{{2|en}}}'
|where  = T.target_id = '{{{1}}}' AND T.language='{{{2|en}}}'
           AND EN.target_id = '{{{1}}}' AND EN.language='en'
           AND EN.target_id = '{{{1}}}' AND EN.language='en'
|fields  = IF('{{{3|}}}' = 'nolink' OR '{{{2|}}}' = 'nolink', T.name, CONCAT('[[', EN.name, '{{#ifeq:{{{2|en}}}|en||/{{{2}}}}}|', T.name, ']]'))
|fields  = T.name
|limit  = 1
|limit  = 1
|more results text=
|more results text=

Revision as of 11:39, 6 August 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: {{Sandbox/Aurelain/Translation|wiki_units_no_counter|en}}

Output: T=Melee,<br>no counter, L=Melee,<br>no counter,



2. Japanese:

Input: {{Sandbox/Aurelain/Translation|nature|ja}}

Output: T=グローヴ, L=グローヴ,



3. Missing id:

Input: {{Sandbox/Aurelain/Translation|foo|en}}

Output: T=foo💬, L=No results,



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

Input: Hello{{Sandbox/Aurelain/Translation|nature|en}}World

Output: HelloT=Grove, L=Grove, World


5. With type, when collisions are a concern:

Input: {{Sandbox/Aurelain/Translation|luck|en|type=unit_stat}}

Output: T=Luck, L=Luck,



6. With field, to get the description:

Input: {{Sandbox/Aurelain/Translation|nature|en|field=description}}

Output: T=Each of the Murmurwoods’ elemental spirits is a unique powerhouse, supported by equally strong — and expensive — rangers and druids., L=Grove,