Module:Buildup: Difference between revisionsGive feedback
Fix for Silver's transformed state. She seems to use her normal form buildup numbers. |
Handle missing translation for Silver (Transformed) on /ru pages |
||
| Line 167: | Line 167: | ||
-- Rows | -- Rows | ||
for _, h in ipairs(hero_list) do | |||
local row = html:tag('tr') | |||
local hero_display | |||
if h.name == "Silver (Transformed)" then | |||
-- Detect page language from subpage (e.g. /ru) | |||
local currentTitle = mw.title.getCurrentTitle().fullText | |||
local langCode = currentTitle:match("/([^/]+)$") or "en" | |||
local isRussian = (langCode == "ru") | |||
local displayName = isRussian and "Сильвер (Трансформация)" or "Silver (Transformed)" | |||
local linkTarget = isRussian and "Silver (Transformed)/ru" or "Silver (Transformed)" | |||
local icon_file = string.format('[[File:Silver.png|20px|link=%s]]', linkTarget) | |||
local name_link = string.format('[[%s|%s]]', linkTarget, displayName) | |||
hero_display = string.format( | |||
'<span style="white-space:nowrap;">' | |||
.. '<span style="position:relative; bottom:2px;">%s</span>' | |||
.. ' %s' | |||
.. '</span>', | |||
icon_file, name_link | |||
) | |||
else | |||
hero_display = frame:expandTemplate{ title = 'HeroIcon', args = { h.name } } | |||
end | |||
row:tag('td') | |||
:attr('data-sort-value', h.name) | |||
:wikitext(hero_display) | |||
row:tag('td'):wikitext(string.format("%.1f", h.bps)) | |||
row:tag('td'):wikitext(tostring(h.shots)) | |||
end | |||
return tostring(html) | return tostring(html) | ||