Translate worldedit_commands (#229)

This commit is contained in:
Alexander Chibrikin
2023-10-23 21:52:04 +03:00
committed by GitHub
parent 8f60e6f729
commit ccfb6b4d61
6 changed files with 530 additions and 199 deletions

View File

@ -1,3 +1,5 @@
local S = minetest.get_translator("worldedit_commands")
local safe_region_callback = {}
--`count` is the number of nodes that would possibly be modified
@ -9,7 +11,7 @@ local function safe_region(name, count, callback)
--save callback to call later
safe_region_callback[name] = callback
worldedit.player_notify(name, "WARNING: this operation could affect up to " .. count .. " nodes; type //y to continue or //n to cancel")
worldedit.player_notify(name, S("WARNING: this operation could affect up to @1 nodes; type //y to continue or //n to cancel", count))
end
local function reset_pending(name)
@ -18,11 +20,11 @@ end
minetest.register_chatcommand("/y", {
params = "",
description = "Confirm a pending operation",
description = S("Confirm a pending operation"),
func = function(name)
local callback = safe_region_callback[name]
if not callback then
worldedit.player_notify(name, "no operation pending")
worldedit.player_notify(name, S("no operation pending"))
return
end
@ -33,10 +35,10 @@ minetest.register_chatcommand("/y", {
minetest.register_chatcommand("/n", {
params = "",
description = "Abort a pending operation",
description = S("Abort a pending operation"),
func = function(name)
if not safe_region_callback[name] then
worldedit.player_notify(name, "no operation pending")
worldedit.player_notify(name, S("no operation pending"))
return
end