Module:Lang/doc: Difference between revisions

Jump to navigation Jump to search
No edit summary
Line 6: Line 6:
Localizes a given string to the current language, i.e. [[Data:Lang_en.json]] for english.
Localizes a given string to the current language, i.e. [[Data:Lang_en.json]] for english.


Note: If you need to get a string that uses a value referenced from another Data page, use the <code>process_variables</code> function from [[Module:Utilities]] instead.
Note: If you need to get a string that uses a value referenced from another Data page, pass the <code>item_name</code> parameter to <code>get_string</code>.


===Parameters===
===Parameters===
Line 27: Line 27:


{{#invoke:Lang|get_string|CitadelHeroStats_Weapon_Falloff|lang_code_override=es}}
{{#invoke:Lang|get_string|CitadelHeroStats_Weapon_Falloff|lang_code_override=es}}
==== Strings with Variables ====
For strings containing <code>{s:variable}</code>, provide the <code>item_name</code>:
'''Example:'''
<code><nowiki>{{#invoke:Lang|get_string|upgrade_target_stun_desc|item_name=Knockdown}}</nowiki></code>
→ {{#invoke:Lang|get_string|upgrade_target_stun_desc|item_name=Knockdown}}
Without <code>item_name</code>, variables won't be filled:
<code><nowiki>{{#invoke:Lang|get_string|upgrade_target_stun_desc}}</nowiki></code>
→ {{#invoke:Lang|get_string|upgrade_target_stun_desc}}