From 79271b9245d2fbe7ebe185388025a6d0afc48752 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Jaenisch?= Date: Sat, 20 Sep 2025 14:52:11 +0200 Subject: [PATCH] fix: define locale variable earlier MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Thanks to #477 / @SPFabGerman I got aware of this issue. Basically I tried to use locale table before it was defined. Signed-off-by: André Jaenisch --- weather-api-widget/weather.lua | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/weather-api-widget/weather.lua b/weather-api-widget/weather.lua index 6ecc8a99..61d65066 100644 --- a/weather-api-widget/weather.lua +++ b/weather-api-widget/weather.lua @@ -169,6 +169,8 @@ end local function worker(user_args) local args = user_args or {} + local lang = args.lang or SYS_LANG + local locale = get_locale(lang) --- Validate required parameters if args.coordinates == nil or args.api_key == nil then @@ -182,7 +184,6 @@ local function worker(user_args) local api_key = args.api_key local font_name = args.font_name or beautiful.font:gsub("%s%d+$", "") local units = args.units or 'metric' - local lang = args.lang or SYS_LANG local time_format_12h = args.time_format_12h local both_units_widget = args.both_units_widget or false local icon_pack_name = args.icons or 'weather-underground-icons' @@ -193,8 +194,6 @@ local function worker(user_args) local timeout = args.timeout or 120 local ICONS_DIR = WIDGET_DIR .. '/icons/' .. icon_pack_name .. '/' - local locale = get_locale(lang) - -- Forecast endpoint includes current. I could map show_daily_forecast to days here. -- Currently overfetching but only showing when opting in. local weather_api =