Translate worldedit_brush

This commit is contained in:
sfan5 2024-04-21 23:00:57 +02:00
parent 4b470bdae6
commit 74663869f7
3 changed files with 39 additions and 17 deletions

View File

@ -1,8 +1,4 @@
if minetest.raycast == nil then
error(
"worldedit_brush requires at least Minetest 5.0"
)
end
local S = minetest.get_translator("worldedit_brush")
local BRUSH_MAX_DIST = 150
local brush_on_use = function(itemstack, placer)
@ -12,7 +8,8 @@ local brush_on_use = function(itemstack, placer)
local cmd = meta:get_string("command")
if cmd == "" then
worldedit.player_notify(name,
"This brush is not bound, use //brush to bind a command to it.")
S("This brush is not bound, use @1 to bind a command to it.",
minetest.colorize("#00ffff", "//brush")))
return false
end
@ -22,7 +19,7 @@ local brush_on_use = function(itemstack, placer)
local has_privs, missing_privs = minetest.check_player_privs(name, cmddef.privs)
if not has_privs then
worldedit.player_notify(name,
"Missing privileges: " .. table.concat(missing_privs, ", "))
S("Missing privileges: @1", table.concat(missing_privs, ", ")))
return false
end
@ -32,7 +29,7 @@ local brush_on_use = function(itemstack, placer)
local ray = minetest.raycast(raybegin, rayend, false, true)
local pointed_thing = ray:next()
if pointed_thing == nil then
worldedit.player_notify(name, "Too far away.")
worldedit.player_notify(name, S("Too far away."))
return false
end
@ -61,7 +58,7 @@ local brush_on_use = function(itemstack, placer)
end
minetest.register_tool(":worldedit:brush", {
description = "WorldEdit Brush",
description = S("WorldEdit Brush"),
inventory_image = "worldedit_brush.png",
stack_max = 1, -- no need to stack these (metadata prevents this anyway)
range = 0,
@ -74,7 +71,7 @@ minetest.register_tool(":worldedit:brush", {
worldedit.register_command("brush", {
privs = {worldedit=true},
params = "none/<cmd> [parameters]",
description = "Assign command to WorldEdit brush item",
description = S("Assign command to WorldEdit brush item or clear assignment using 'none'"),
parse = function(param)
local found, _, cmd, params = param:find("^([^%s]+)%s+(.+)$")
if not found then
@ -89,7 +86,7 @@ worldedit.register_command("brush", {
func = function(name, cmd, params)
local itemstack = minetest.get_player_by_name(name):get_wielded_item()
if itemstack == nil or itemstack:get_name() ~= "worldedit:brush" then
worldedit.player_notify(name, "Not holding brush item.")
worldedit.player_notify(name, S("Not holding brush item."))
return
end
@ -97,28 +94,29 @@ worldedit.register_command("brush", {
local meta = itemstack:get_meta()
if cmd == "none" then
meta:from_table(nil)
worldedit.player_notify(name, "Brush assignment cleared.")
worldedit.player_notify(name, S("Brush assignment cleared."))
else
local cmddef = worldedit.registered_commands[cmd]
if cmddef == nil or cmddef.require_pos ~= 1 then
worldedit.player_notify(name, minetest.colorize("#00ffff", "//"..cmd) .. " cannot be used with brushes")
worldedit.player_notify(name, S("@1 cannot be used with brushes",
minetest.colorize("#00ffff", "//"..cmd)))
return
end
-- Try parsing command params so we can give the user feedback
local ok, err = cmddef.parse(params)
if not ok then
err = err or "invalid usage"
worldedit.player_notify(name, "Error with brush command: " .. err)
err = err or S("invalid usage")
worldedit.player_notify(name, S("Error with command: @1", err))
return
end
meta:set_string("command", cmd)
meta:set_string("params", params)
local fullcmd = "//" .. cmd .. " " .. params
local fullcmd = minetest.colorize("#00ffff", "//"..cmd) .. " " .. params
meta:set_string("description",
minetest.registered_tools["worldedit:brush"].description .. ": " .. fullcmd)
worldedit.player_notify(name, "Brush assigned to command: " .. fullcmd)
worldedit.player_notify(name, S("Brush assigned to command: @1", fullcmd))
end
minetest.get_player_by_name(name):set_wielded_item(itemstack)
end,

View File

@ -0,0 +1,12 @@
# textdomain: worldedit_brush
This brush is not bound, use @1 to bind a command to it.=
Missing privileges: @1=
Too far away.=
WorldEdit Brush=
Assign command to WorldEdit brush item or clear assignment using 'none'=
Not holding brush item.=
Brush assignment cleared.=
@1 cannot be used with brushes=
invalid usage=
Error with command: @1=
Brush assigned to command: @1=

View File

@ -0,0 +1,12 @@
# textdomain: worldedit_brush
This brush is not bound, use @1 to bind a command to it.=Dieser Pinsel ist nicht konfiguriert, nutzen Sie @1 um ein Befehl an ihn zu binden.
Missing privileges: @1=Fehlende Privilegien: @1
Too far away.=Zu weit weg.
WorldEdit Brush=WorldEdit-Pinsel
Assign command to WorldEdit brush item or clear assignment using 'none'=Befehl an WorldEdit-Pinsel binden oder Zuweisung mittels 'none' aufheben
Not holding brush item.=Kein Pinsel in der Hand.
Brush assignment cleared.=Pinsel-Zuweisung aufgehoben.
@1 cannot be used with brushes=@1 kann nicht mit Pinseln verwendet werden
invalid usage=Ungültige Verwendung
Error with command: @1=Befehl ist fehlerhaft: @1
Brush assigned to command: @1=Pinsel an Befehl gebunden: @1