Module:HeroData: Difference between revisions

Jump to navigation Jump to search
Sur (talk | contribs)
m table content fitting corrected
Sur (talk | contribs)
m postfix and non-localized keys have proper spacing for hero comparison
Line 504: Line 504:
local header_style = ""
local header_style = ""
local category_data = attribute_module.get_category_data()
local category_data = attribute_module.get_category_data()
local postfix
-- Iterate stats again for displaying headers with their respective color
-- Iterate stats again for displaying headers with their respective color
Line 515: Line 516:
attr_data = category_attrs[attr_key]
attr_data = category_attrs[attr_key]
-- If not in attributes data, use key as localized
if (attr_data ~= nil) then
if (attr_data ~= nil) then
-- Localize, fallback to attr_key
-- 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 = attr_key end
if (attr_localized == nil) then attr_localized = util_module.add_space_before_cap(attr_key) end
else
attr_localized = attr_key
-- Get postfix
postfix = lang_module._get_string(attr_data["postfix"])
if (postfix == nil or postfix == "") then
postfix = ""
else
postfix = " (" .. postfix .. ")"
end
else -- If not in attributes data, use key with proper spacing
attr_localized = util_module.add_space_before_cap(attr_key)
end
end
Line 527: Line 536:
header_style = ' style="background-color: ' .. "rgb(" .. category_rgb .. ') ;"'
header_style = ' style="background-color: ' .. "rgb(" .. category_rgb .. ') ;"'
headers_str = headers_str .. "<th" .. header_style .. ">" .. attr_localized .. "</th>"
headers_str = headers_str .. "<th" .. header_style .. ">" .. attr_localized .. postfix .. "</th>"
end
end
end
end