Template:Infobox item: Difference between revisions

Codename
simplified code to use item_name as key and localize the displayed item name
Line 1: Line 1:
<includeonly><!--
<includeonly><!--
-->{{#if: {{{key|}}} |<!-- If key is provided
-->{{#vardefine:item_key_or_en|{{{item_name}}}}}<!-- item name (en)
-->{{#vardefine:item_key_or_en|{{{key}}}}}<!-- key
-->{{#vardefine:item_en|{{#invoke:Lang|get_string|{{{item_name}}}|lang_code_override=en}}}}<!-- en
-->{{#vardefine:item_en|{{#invoke:Lang|get_string|{{{key}}}|lang_code_override=en}}}}<!-- en
-->|<!-- If key is not provided, use {{{1}}} and assume its in english where it will be re-localized to current language in called functions
-->{{#vardefine:item_key_or_en|{{{1}}}}}<!-- en
-->{{#vardefine:item_en|{{{1}}}}}<!-- en
-->}}<!--
--><div class="infobox_item" style="float:right; display:inline-block; vertical-align:top;">
--><div class="infobox_item" style="float:right; display:inline-block; vertical-align:top;">
{| style="text-align:left; border-collapse:collapse; width:312px; max-width:100%; height:30px; color: #FFEFD7; padding:12px; font-family:'Retail Demo Regular',serif; {{
{| style="text-align:left; border-collapse:collapse; width:312px; max-width:100%; height:30px; color: #FFEFD7; padding:12px; font-family:'Retail Demo Regular',serif; {{
Line 19: Line 14:
  | Vitality = background-color: #659818;
  | Vitality = background-color: #659818;
  | Spirit = background-color: #8B56B4;
  | Spirit = background-color: #8B56B4;
  | background-color: #C97A03;}}" |<span style="font-weight:bold; text-shadow: 2px 2px rgba(0, 0, 0, 0.2); ">{{{item_name|{{#var:item_key_or_en}}}}}</span>
  | background-color: #C97A03;}}" |<span style="font-weight:bold; text-shadow: 2px 2px rgba(0, 0, 0, 0.2); ">{{{item_name_loc|{{#invoke:Lang|get_string|{{#invoke:ItemData|get_codename|{{#var:item_key_or_en}}}}}}}}}</span>
<!--! style="vertical-align:bottom; font-size:26px; font-family:'Retail Demo Bold',serif; {{
<!--! style="vertical-align:bottom; font-size:26px; font-family:'Retail Demo Bold',serif; {{
#switch: {{{item_type}}}
#switch: {{{item_type}}}