Module:HeroData: Difference between revisions

Jump to navigation Jump to search
Sur (talk | contribs)
m icon alts fixed for default_items
Sur (talk | contribs)
m _get_string > get_string
Line 63: Line 63:
--localize
--localize
if (sig_figs_or_localize == "true") then
if (sig_figs_or_localize == "true") then
return lang_module._get_string(var_value)
return lang_module.get_string(var_value)
end
end


Line 84: Line 84:
if localize=="true" then  
if localize=="true" then  
element = lang_module._get_string(element)
element = lang_module.get_string(element)
end
end
Line 99: Line 99:
for i, item_key in ipairs(hero["RecommendedItems"]) do
for i, item_key in ipairs(hero["RecommendedItems"]) do
template_args = {}
template_args = {}
template_args[1] = lang_module._get_string(item_key, 'en')
template_args[1] = lang_module.get_string(item_key, 'en')
template_args['alt'] = lang_module._get_string(item_key)
template_args['alt'] = lang_module.get_string(item_key)
local expanded_template = mw.getCurrentFrame():expandTemplate{ title = template_title, args = template_args }
local expanded_template = mw.getCurrentFrame():expandTemplate{ title = template_title, args = template_args }
str = str .. "* " .. expanded_template .. "\n"
str = str .. "* " .. expanded_template .. "\n"
Line 196: Line 196:
     template_args["name_english"] = hero_name
     template_args["name_english"] = hero_name
      
      
     template_args["name_localized"] = lang_module._get_string(p.get_hero_key(hero_name))
     template_args["name_localized"] = lang_module.get_string(p.get_hero_key(hero_name))
      
      
     local wep_name = hero_data["WeaponName"]
     local wep_name = hero_data["WeaponName"]
     if (wep_name ~= nil) then template_args["weapon_name"] = lang_module._get_string(wep_name) end
     if (wep_name ~= nil) then template_args["weapon_name"] = lang_module.get_string(wep_name) end
      
      
     local wep_desc = hero_data["WeaponDescription"]
     local wep_desc = hero_data["WeaponDescription"]
     if (wep_desc ~= nil) then template_args["weapon_description"] = lang_module._get_string(wep_desc) end
     if (wep_desc ~= nil) then template_args["weapon_description"] = lang_module.get_string(wep_desc) end
      
      
     local role = hero_data["Role"]
     local role = hero_data["Role"]
     if (role ~= nil) then template_args["role"] = lang_module._get_string(role) end
     if (role ~= nil) then template_args["role"] = lang_module.get_string(role) end
      
      
     local playstyle = hero_data["Playstyle"]
     local playstyle = hero_data["Playstyle"]
     if (playstyle ~= nil) then template_args["playstyle"] = lang_module._get_string(playstyle) end
     if (playstyle ~= nil) then template_args["playstyle"] = lang_module.get_string(playstyle) end
      
      
     -- Iterate attribute categories
     -- Iterate attribute categories
Line 230: Line 230:
-- get label and postfix
-- get label and postfix
label = lang_module._get_string(stat_data["label"])
label = lang_module.get_string(stat_data["label"])
postfix = stat_data["postfix"]
postfix = stat_data["postfix"]
if (postfix == nil) then  
if (postfix == nil) then  
Line 236: Line 236:
else
else
-- light grey for postfixes
-- light grey for postfixes
postfix = lang_module._get_string(postfix)
postfix = lang_module.get_string(postfix)
if (postfix == nil) then
if (postfix == nil) then
postfix = ""
postfix = ""
Line 327: Line 327:
-- get label and postfix
-- get label and postfix
label = lang_module._get_string(stat_data["label"])
label = lang_module.get_string(stat_data["label"])
postfix = stat_data["postfix"]
postfix = stat_data["postfix"]
if (postfix == nil) then  
if (postfix == nil) then  
Line 333: Line 333:
else
else
-- light grey for postfixes
-- light grey for postfixes
postfix = '<span style="color: #666666;">' .. lang_module._get_string(postfix) .. "</span>"
postfix = '<span style="color: #666666;">' .. lang_module.get_string(postfix) .. "</span>"
end
end
-- if a language is missing the postfix, use no postfix
-- if a language is missing the postfix, use no postfix
Line 465: Line 465:
-- Retrieve hero's localized name
-- Retrieve hero's localized name
hero_name = lang_module._get_string(hero_key)
hero_name = lang_module.get_string(hero_key)
-- Retrieve hero's english name, used for hero icon
-- Retrieve hero's english name, used for hero icon
Line 555: Line 555:
if (attr_data ~= nil) then
if (attr_data ~= nil) then
-- Localize, fallback to attr_key with proper spaces
-- Localize, fallback to attr_key with proper spaces
attr_localized = lang_module._get_string(attr_data["label"])
attr_localized = lang_module.get_string(attr_data["label"])
if (attr_localized == nil) then attr_localized = util_module.add_space_before_cap(attr_key) end
if (attr_localized == nil) then attr_localized = util_module.add_space_before_cap(attr_key) end
-- Get postfix
-- Get postfix
postfix = lang_module._get_string(attr_data["postfix"])
postfix = lang_module.get_string(attr_data["postfix"])
if (postfix == nil or postfix == "") then  
if (postfix == nil or postfix == "") then  
postfix = ""  
postfix = ""