From dffe9cc9b2cb4504f67fd060a2b971001c7f6348 Mon Sep 17 00:00:00 2001 From: Er2 Date: Sun, 23 Jan 2022 21:44:39 +0300 Subject: [PATCH] restored localized commands --- etc/api | 2 +- src/events/ready.lua | 21 ++++++++++++--------- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/etc/api b/etc/api index 4dec800..5e6f1b9 160000 --- a/etc/api +++ b/etc/api @@ -1 +1 @@ -Subproject commit 4dec8003ed89e5a05ee992448747096f72ce718b +Subproject commit 5e6f1b9ec7665adc121c03757775e65fc587a37b diff --git a/src/events/ready.lua b/src/events/ready.lua index 2e149d3..feac38a 100644 --- a/src/events/ready.lua +++ b/src/events/ready.lua @@ -27,17 +27,20 @@ end return function(C, api) C:load 'cmds' - local a = {} - for k, v in pairs(C.cmds) do - if not (v.private or v.hide) then - local cmd = C.locale:get('cmds', k) or {} - table.insert(a, { - command = k, - description = (cmd.args and cmd.args .. ' - ' or '') .. (cmd.desc or C.locale:get('cmds', 'not_des')) - }) + local a + for _, lang in pairs(C.locale.list) do + a = {} + for k, v in pairs(C.cmds) do + if not (v.private or v.hide) then + local cmd = C.locale:get('cmds', k, lang) or {} + table.insert(a, { + command = k, + description = (cmd.args and cmd.args .. ' - ' or '') .. (cmd.desc or C.locale:get('cmds', 'not_des')) + }) + end end + api:setMyCommands(a, lang) end - api:setMyCommands(a) --[[ a = {'levels', }