Skip to content

Commit 6bf60b0

Browse files
committed
Change localization for commands
1 parent 6c8fc68 commit 6bf60b0

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

models/BetterCommands/control.lua

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ local function add_custom_command(command_settings, original_func)
9292
end
9393
end
9494

95-
local command_description = command_settings.description
95+
local command_description = command_settings.description or {MOD_NAME .. "-commands." .. command_settings.name}
9696
commands.add_command(command_name, command_description, function(cmd)
9797
if cmd.player_index == 0 then
9898
if command_settings.allow_for_server == false then
@@ -252,13 +252,14 @@ function M:create_settings()
252252
local new_settings = {}
253253
for key, command in pairs(SWITCHABLE_COMMANDS) do
254254
local command_name = command.name or key
255+
local description = command.description or {MOD_NAME .. "-commands." .. command_name}
255256
new_settings[#new_settings + 1] = {
256257
type = "bool-setting",
257258
name = MOD_SHORT_NAME .. key,
258259
setting_type = "runtime-global",
259260
default_value = command.default_value or true,
260261
localised_name = '/' .. command_name,
261-
localised_description = {'', '/' .. command_name, ' ', command.description or ''}
262+
localised_description = {'', '/' .. command_name, ' ', description}
262263
}
263264
end
264265
if #new_settings > 0 then

switchable-commands.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,5 @@ Returns tables of commands without functions as command "settings". All paramete
1616
]]--
1717
---@type table<string, table>
1818
return {
19-
delete_example_UI = {name = "delete-example-UI", description = {"example-mod-commands.delete-example-UI"}}, -- See models/example-module.lua
19+
delete_example_UI = {name = "delete-example-UI"}, -- See models/example-module.lua
2020
}

0 commit comments

Comments
 (0)