Skip to content

Commit 589c68a

Browse files
committed
fix: use locale only once set
1 parent c4e42c4 commit 589c68a

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

weather-api-widget/weather.lua

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -172,14 +172,6 @@ local function worker(user_args)
172172
local lang = args.lang or SYS_LANG
173173
local locale = get_locale(lang)
174174

175-
--- Validate required parameters
176-
if args.coordinates == nil or args.api_key == nil then
177-
show_warning(locale.parameter_warning ..
178-
(args.coordinates == nil and '<b>coordinates</b>' or '') ..
179-
(args.api_key == nil and ', <b>api_key</b> ' or ''))
180-
return
181-
end
182-
183175
local coordinates = args.coordinates
184176
local api_key = args.api_key
185177
local font_name = args.font_name or beautiful.font:gsub("%s%d+$", "")
@@ -194,6 +186,13 @@ local function worker(user_args)
194186
local timeout = args.timeout or 120
195187
local ICONS_DIR = WIDGET_DIR .. '/icons/' .. icon_pack_name .. '/'
196188

189+
--- Validate required parameters
190+
if args.coordinates == nil or args.api_key == nil then
191+
show_warning(locale.parameter_warning ..
192+
(args.coordinates == nil and '<b>coordinates</b>' or '') ..
193+
(args.api_key == nil and ', <b>api_key</b> ' or ''))
194+
return
195+
end
197196
-- Forecast endpoint includes current. I could map show_daily_forecast to days here.
198197
-- Currently overfetching but only showing when opting in.
199198
local weather_api =

0 commit comments

Comments
 (0)