Skip to content

Commit

Permalink
Fix grid menu caching I18N entries before I18N actually runs (#4186)
Browse files Browse the repository at this point in the history
#4038 moved I18N initialization from setupdefs.lua into purely widget space. This broke grid menu, as it was caching its I18N entries outside of callins, so was running before the gui_language widget, even though it is on a higher layer.
  • Loading branch information
WatchTheFort authored Jan 18, 2025
1 parent 3394daf commit ebfcff3
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions luaui/Widgets/gui_gridmenu.lua
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,7 @@ local function refreshUnitDefs()
unitBuildOptions[udid] = ud.buildOptions
unitTranslatedHumanName[udid] = ud.translatedHumanName
unitTranslatedTooltip[udid] = ud.translatedTooltip

if ud.customParams.metal_extractor then
unitMetal_extractor[udid] = ud.customParams.metal_extractor
end
Expand All @@ -323,8 +324,6 @@ local function refreshUnitDefs()
end
end

refreshUnitDefs()

-- starting units
local startUnits = { UnitDefNames.armcom.id, UnitDefNames.corcom.id }
if Spring.GetModOptions().experimentallegionfaction then
Expand Down Expand Up @@ -1239,6 +1238,8 @@ local function cycleBuilder()
end

function widget:Initialize()
refreshUnitDefs()

if widgetHandler:IsWidgetKnown("Build menu") then
-- Build menu needs to be disabled right now and before we recreate
-- WG['buildmenu'] since its Shutdown will destroy it.
Expand Down

0 comments on commit ebfcff3

Please sign in to comment.