Editing Module:IconGive feedback
Jump to navigation
Jump to search
The edit can be undone.
Please check the comparison below to verify that this is what you want to do, and then publish the changes below to finish undoing the edit.
| Latest revision | Your text | ||
| Line 51: | Line 51: | ||
end | end | ||
-- | -- Build localized anchor (#Abilities) | ||
local function getLocalizedAnchor(key, fallback, langCode) | |||
local anchor = fallback | |||
if langCode ~= "en" and key then | |||
local translated = lang_module.get_string(key, langCode, fallback) | |||
if type(translated) == "string" then | |||
anchor = translated:gsub("<[^>]+>", "") | |||
end | |||
end | |||
anchor = anchor:gsub(" ", "_") | |||
return anchor | |||
end | |||
-- Infer link from type and available fields | |||
local function getLink(iconInfo, langCode) | |||
if iconInfo.type == "ability" then | |||
local hero = iconInfo.hero_name or iconInfo.name | |||
-- Data:Lang en.json | |||
local anchor = getLocalizedAnchor("guide_basics_abilities_header", "Abilities", langCode) | |||
return hero .. "#" .. anchor | |||
end | |||
return linkOverrides[iconInfo.name] or iconInfo.name | |||
end | |||
local function getTranslatedName(iconInfo, langCode) | local function getTranslatedName(iconInfo, langCode) | ||
if langCode == "en" then | if langCode == "en" then | ||
| Line 63: | Line 89: | ||
if type(translated) == "string" then | if type(translated) == "string" then | ||
return | return translated:gsub("<[^>]+>", "") | ||
end | end | ||
| Line 82: | Line 108: | ||
-- No valid key > fallback | -- No valid key > fallback | ||
return iconInfo.name | return iconInfo.name | ||
end | end | ||
| Line 121: | Line 130: | ||
end | end | ||
local langCode = getLangCode() | local langCode = getLangCode() | ||
| Line 206: | Line 214: | ||
style = 'class="module-icon-ability" style="position:relative; bottom:2px;"' | style = 'class="module-icon-ability" style="position:relative; bottom:2px;"' | ||
else | else | ||
style = ' | style = 'style="position:relative; bottom:2px;"' | ||
end | end | ||