Module:Dictionary/doc: Difference between revisions

Sur (talk | contribs)
m now includes show_needs_translation and better examples
Sur (talk | contribs)
m examples with fallback_str being blank
Line 9: Line 9:
*'''key''' - key to translate
*'''key''' - key to translate
*'''lang_code_override''' (OPTIONAL, Named parameter) - language code that overrides current language. See supported list at [[Data:LangCodes.json]].
*'''lang_code_override''' (OPTIONAL, Named parameter) - language code that overrides current language. See supported list at [[Data:LangCodes.json]].
*'''fallback_str''' (OPTIONAL, Named parameter) - string to return if '''key''' cannot be translated. Defaults to the english translation. Use a blank string or nil for easier catching of missed translations, where the needs translation tooltip will also not be added.
*'''show_needs_translation''' (OPTIONAL, Named parameter) - boolean that determines if the {{NeedsTranslationTooltip}} is appended when its unable to be translated. Defaults to 'true'
*'''show_needs_translation''' (OPTIONAL, Named parameter) - boolean that determines if the {{NeedsTranslationTooltip}} is appended when its unable to be translated. Defaults to 'true'


Line 29: Line 30:


Example where translation does not yet exist but displaying the tooltip is off<br>
Example where translation does not yet exist but displaying the tooltip is off<br>
<code><nowiki>{{#invoke:Dictionary|translate|Update history|show_needs_translation=false}}</nowiki></code>
<code><nowiki>{{#invoke:Dictionary|translate|Update history|lang_code_override=es|show_needs_translation=false}}</nowiki></code>


Outputs
Outputs


{{#invoke:Dictionary|translate|Update history|show_needs_translation=false}}
{{#invoke:Dictionary|translate|Update history|lang_code_override=es|show_needs_translation=false}}
 
Example where translation does not yet exist and the fallback is an empty string<br>
<code><nowiki>{{#invoke:Dictionary|translate|Update history|lang_code_override=es|fallback_str=}}</nowiki></code>
 
Outputs
 
{{#invoke:Dictionary|translate|Update history|lang_code_override=es|fallback_str=}}
 
 
Example where translation does not yet exist and the fallback is another text<br>
<code><nowiki>{{#invoke:Dictionary|translate|Update history|lang_code_override=es|fallback_str=My custom fallback text}}</nowiki></code>
 
Outputs
 
{{#invoke:Dictionary|translate|Update history|lang_code_override=es|fallback_str=My custom fallback text}}


==translate_embed==
==translate_embed==