Module:Lang/doc: Difference between revisionsGive feedback
Jump to navigation
Jump to search
m recommendation for fallback_str |
m dictionary fallback example, and fixed last fallback example |
||
| Line 9: | Line 9: | ||
* '''key''' - Key string to localize | * '''key''' - Key string to localize | ||
* '''lang_code_override''' (OPTIONAL) - Overrides the current language to a specific language code | * '''lang_code_override''' (OPTIONAL) - Overrides the current language to a specific language code | ||
* '''fallback_str''' (OPTIONAL) - Passing <code>en</code> causes it to return the english localization if it can't be localized to the current language. Passing any other string causes it to return that string if it can't be localized. Both have [[Template:MissingValveTranslationTooltip]] appended. Use this very often as some keys are not yet localized in every language by the game. If parsing the fallback_str from lua and is computationally expensive (i.e. add_space_before_cap), consider using fallback outside this function so it only computes when needed. | * '''fallback_str''' (OPTIONAL) - Passing <code>en</code> causes it to return the english localization if it can't be localized to the current language. Passing any other string causes it to return that string if it can't be localized. Both have [[Template:MissingValveTranslationTooltip]] appended. Use this very often as some keys are not yet localized in every language by the game. Passing <code>dictionary</code> causes it to return the translation via [[Data:Dictionary]] if it can't be localized. If parsing the fallback_str from lua and is computationally expensive (i.e. add_space_before_cap), consider using fallback outside this function so it only computes when needed. | ||
* '''remove_var_index''' (OPTIONAL) - Removes %variables% from the resulting string. -1 also removes the character prefixing %variables%, while 1 removes the postfixed character, and 0 removes only the %variables%. | * '''remove_var_index''' (OPTIONAL) - Removes %variables% from the resulting string. -1 also removes the character prefixing %variables%, while 1 removes the postfixed character, and 0 removes only the %variables%. | ||
| Line 33: | Line 33: | ||
<code><nowiki>{{#invoke:Lang|StatDesc_CritDamageBonusScale | <code><nowiki>{{#invoke:Lang|get_string|StatDesc_CritDamageBonusScale|lang_code_override=es|fallback_str=en}}</nowiki></code> | ||
{{#invoke:Lang|get_string|StatDesc_CritDamageBonusScale|lang_code_override=es|fallback_str=en}} | {{#invoke:Lang|get_string|StatDesc_CritDamageBonusScale|lang_code_override=es|fallback_str=en}} | ||
| Line 41: | Line 41: | ||
{{#invoke:Lang|get_string|StatDesc_CritDamageBonusScale|lang_code_override=es|fallback_str=Crit Damage Bonus Scale}} | {{#invoke:Lang|get_string|StatDesc_CritDamageBonusScale|lang_code_override=es|fallback_str=Crit Damage Bonus Scale}} | ||
<code><nowiki>{{#invoke:Lang|get_string|Tech Items|fallback_str=dictionary}}</nowiki></code> | |||
{{#invoke:Lang|get_string|Tech Items|fallback_str=dictionary}} | |||
===Examples for remove_var_index=== | ===Examples for remove_var_index=== | ||