31
31
32
32
local cmd_marker = " /"
33
33
34
+ local function gettext (...)
35
+ return ...
36
+ end
37
+
38
+ local function gettext_replace (text , replace )
39
+ return text :gsub (" $1" , replace )
40
+ end
41
+
42
+
34
43
if INIT == " client" then
35
44
cmd_marker = " ."
45
+ gettext = core .gettext
46
+ gettext_replace = fgettext_ne
36
47
end
37
48
38
49
local function do_help_cmd (name , param )
@@ -54,9 +65,9 @@ local function do_help_cmd(name, param)
54
65
end
55
66
end
56
67
table.sort (cmds )
57
- return true , " Available commands: " .. table.concat (cmds , " " ) .. " \n "
58
- .. " Use '" .. cmd_marker .. " help <cmd>' to get more information,"
59
- .. " or '" .. cmd_marker .. " help all' to list everything."
68
+ return true , gettext ( " Available commands: " ) .. table.concat (cmds , " " ) .. " \n "
69
+ .. gettext_replace ( " Use '$1help <cmd>' to get more information,"
70
+ .. " or '$1help all' to list everything." , cmd_marker )
60
71
elseif param == " all" then
61
72
local cmds = {}
62
73
for cmd , def in pairs (core .registered_chatcommands ) do
@@ -65,7 +76,7 @@ local function do_help_cmd(name, param)
65
76
end
66
77
end
67
78
table.sort (cmds )
68
- return true , " Available commands:\n " .. table.concat (cmds , " \n " )
79
+ return true , gettext ( " Available commands:" ) .. " \n " .. table.concat (cmds , " \n " )
69
80
elseif INIT == " game" and param == " privs" then
70
81
local privs = {}
71
82
for priv , def in pairs (core .registered_privileges ) do
@@ -77,7 +88,7 @@ local function do_help_cmd(name, param)
77
88
local cmd = param
78
89
local def = core .registered_chatcommands [cmd ]
79
90
if not def then
80
- return false , " Command not available: " .. cmd
91
+ return false , gettext ( " Command not available: " ) .. cmd
81
92
else
82
93
return true , format_help_line (cmd , def )
83
94
end
86
97
87
98
if INIT == " client" then
88
99
core .register_chatcommand (" help" , {
89
- params = " [all/<cmd>]" ,
90
- description = " Get help for commands" ,
100
+ params = gettext ( " [all/<cmd>]" ) ,
101
+ description = gettext ( " Get help for commands" ) ,
91
102
func = function (param )
92
103
return do_help_cmd (nil , param )
93
104
end ,
0 commit comments