[init] handle the case in which translate() gets called with no dictionary.
This commit is contained in:
parent
cc9d45cb44
commit
a3488431b2
3
init.lua
3
init.lua
|
@ -90,8 +90,9 @@ end
|
||||||
--
|
--
|
||||||
-- @return localized and formatted string.
|
-- @return localized and formatted string.
|
||||||
function moonspeak.translate(id, ...)
|
function moonspeak.translate(id, ...)
|
||||||
local msg = rawget(moonspeak.dict, id)
|
local dict = moonspeak.dict
|
||||||
local lang = moonspeak.lang
|
local lang = moonspeak.lang
|
||||||
|
local msg = dict and dict[id] or nil
|
||||||
|
|
||||||
if msg ~= nil and msg[lang] then
|
if msg ~= nil and msg[lang] then
|
||||||
-- Found localized string.
|
-- Found localized string.
|
||||||
|
|
Loading…
Reference in New Issue