aboutsummaryrefslogtreecommitdiff
path: root/builtin/common
diff options
context:
space:
mode:
authorred-001 <red-001@outlook.ie>2017-04-10 20:14:00 +0100
committerLoïc Blot <nerzhul@users.noreply.github.com>2017-04-10 21:14:00 +0200
commiteb587996e42544ec8624b256e6d5eea12f9bab88 (patch)
treee42ad2edf080791fe0a171cb2393d1473de6d9eb /builtin/common
parente8d872332040c16714ff6410d1f859adcec4766e (diff)
downloadminetest-eb587996e42544ec8624b256e6d5eea12f9bab88.tar.gz
minetest-eb587996e42544ec8624b256e6d5eea12f9bab88.tar.bz2
minetest-eb587996e42544ec8624b256e6d5eea12f9bab88.zip
[CSM] Use more gettext (#5553)
Diffstat (limited to 'builtin/common')
-rw-r--r--builtin/common/chatcommands.lua25
1 files changed, 18 insertions, 7 deletions
diff --git a/builtin/common/chatcommands.lua b/builtin/common/chatcommands.lua
index 05dd94e8d..e8955c6b4 100644
--- a/builtin/common/chatcommands.lua
+++ b/builtin/common/chatcommands.lua
@@ -31,8 +31,19 @@ end
local cmd_marker = "/"
+local function gettext(...)
+ return ...
+end
+
+local function gettext_replace(text, replace)
+ return text:gsub("$1", replace)
+end
+
+
if INIT == "client" then
cmd_marker = "."
+ gettext = core.gettext
+ gettext_replace = fgettext_ne
end
local function do_help_cmd(name, param)
@@ -54,9 +65,9 @@ local function do_help_cmd(name, param)
end
end
table.sort(cmds)
- return true, "Available commands: " .. table.concat(cmds, " ") .. "\n"
- .. "Use '"..cmd_marker.."help <cmd>' to get more information,"
- .. " or '"..cmd_marker.."help all' to list everything."
+ return true, gettext("Available commands: ") .. table.concat(cmds, " ") .. "\n"
+ .. gettext_replace("Use '$1help <cmd>' to get more information,"
+ .. " or '$1help all' to list everything.", cmd_marker)
elseif param == "all" then
local cmds = {}
for cmd, def in pairs(core.registered_chatcommands) do
@@ -65,7 +76,7 @@ local function do_help_cmd(name, param)
end
end
table.sort(cmds)
- return true, "Available commands:\n"..table.concat(cmds, "\n")
+ return true, gettext("Available commands:").."\n"..table.concat(cmds, "\n")
elseif INIT == "game" and param == "privs" then
local privs = {}
for priv, def in pairs(core.registered_privileges) do
@@ -77,7 +88,7 @@ local function do_help_cmd(name, param)
local cmd = param
local def = core.registered_chatcommands[cmd]
if not def then
- return false, "Command not available: "..cmd
+ return false, gettext("Command not available: ")..cmd
else
return true, format_help_line(cmd, def)
end
@@ -86,8 +97,8 @@ end
if INIT == "client" then
core.register_chatcommand("help", {
- params = "[all/<cmd>]",
- description = "Get help for commands",
+ params = gettext("[all/<cmd>]"),
+ description = gettext("Get help for commands"),
func = function(param)
return do_help_cmd(nil, param)
end,