Module:NavigationGridGive feedback
Documentation for this module may be created at Module:NavigationGrid/doc
local p = {}
local lang = require('Module:Lang')
local dict = require('Module:Dictionary')
function p.renderMainGrid(frame)
-- Process the language subpage suffix once to save performance
local langSuffix = frame:preprocess('{{If_lang}}') or ''
-- All 9 original navigation items mapped out
local items = {
{ img = 'Hero_Nav.png', type = 'lang', key = 'HeroesPageTitle', link = 'Heroes' },
{ img = 'Item_Nav.png', type = 'lang', key = 'Citadel_Scoreboard_Items', link = 'Items' },
{ img = 'Mechanics_Nav.png', type = 'dict', key = 'Mechanics', link = 'Mechanics' },
{ img = 'Updates_Nav.png', type = 'dict', key = 'Updates', link = 'Updates' },
{ img = 'Strategy_Nav.png', type = 'dict', key = 'Strategy', link = 'Strategy' },
{ img = 'Map_Nav.png', type = 'dict', key = 'Map', link = 'Map' },
{ img = 'Movement_Nav.png', type = 'lang', key = 'Citadel_ShopFilter_Movement', link = 'Portal:Movement' },
{ img = 'Lore_Nav.png', type = 'dict', key = 'Lore', link = 'Lore' },
{ img = 'Brawl_Nav.png', type = 'lang', key = 'Citadel_Play_StreetBrawl_Title', link = 'Street Brawl' }
}
local html = '<div class="deadlock-nav-grid">'
for _, item in ipairs(items) do
local label = ""
-- Create a mock frame context to pass to the translation modules safely
local mockFrame = { args = { item.key } }
if item.type == 'lang' then
label = lang.get_string(mockFrame)
else
label = dict.translate(mockFrame)
end
-- Append the language suffix safely to the internal wiki link
local destination = item.link .. langSuffix
-- Construct the individual HTML tile structure
html = html .. string.format(
'<div class="nav-tile">[[File:%s|link=%s]]<span>%s</span></div>',
item.img, destination, label
)
end
html = html .. '</div>'
return html
end
return p