From a3488431b25b9550d59f26badea30bd587057587 Mon Sep 17 00:00:00 2001 From: Lorenzo Cogotti Date: Wed, 17 Aug 2022 12:14:32 +0200 Subject: [PATCH] [init] handle the case in which translate() gets called with no dictionary. --- init.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/init.lua b/init.lua index e235e16..0866a5b 100644 --- a/init.lua +++ b/init.lua @@ -90,8 +90,9 @@ end -- -- @return localized and formatted string. function moonspeak.translate(id, ...) - local msg = rawget(moonspeak.dict, id) + local dict = moonspeak.dict local lang = moonspeak.lang + local msg = dict and dict[id] or nil if msg ~= nil and msg[lang] then -- Found localized string.