Luacontroller: Make some warnings translatable

This commit is contained in:
Wuzzy 2019-08-23 05:42:47 +02:00
parent 9b117280ea
commit 5934d05f64

View File

@ -276,7 +276,7 @@ if mesecon.setting("luacontroller_lightweight_interrupts", false) then
get_interrupt = function(pos, itbl, send_warning)
return (function(time, iid)
if type(time) ~= "number" then error("Delay must be a number") end
if iid ~= nil then send_warning("Interrupt IDs are disabled on this server") end
if iid ~= nil then send_warning(S("Interrupt IDs are disabled on this server")) end
table.insert(itbl, function() minetest.get_node_timer(pos):start(time) end)
end)
end
@ -300,7 +300,7 @@ else
if #msg_ser <= mesecon.setting("luacontroller_interruptid_maxlen", 256) then
mesecon.queue:add_action(pos, "lc_interrupt", {luac_id, iid}, time, iid, 1)
else
send_warning("An interrupt ID was too large!")
send_warning(S("An interrupt ID was too large!"))
end
end)
end
@ -406,18 +406,18 @@ local function get_digiline_send(pos, itbl, send_warning)
-- Make sure channel is string, number or boolean
if type(channel) == "string" then
if #channel > chan_maxlen then
send_warning("Channel string too long.")
send_warning(S("Channel string too long."))
return false
end
elseif (type(channel) ~= "string" and type(channel) ~= "number" and type(channel) ~= "boolean") then
send_warning("Channel must be string, number or boolean.")
send_warning(S("Channel must be string, number or boolean."))
return false
end
local msg_cost
msg, msg_cost = clean_and_weigh_digiline_message(msg)
if msg == nil or msg_cost > maxlen then
send_warning("Message was too complex, or contained invalid data.")
send_warning(S("Message was too complex, or contained invalid data."))
return false
end
@ -590,7 +590,7 @@ local function run_inner(pos, code, event)
-- 'Last warning' label.
local warning = ""
local function send_warning(str)
warning = "Warning: " .. str
warning = S("Warning: @1", str)
end
-- Create environment
@ -610,7 +610,7 @@ local function run_inner(pos, code, event)
-- End string true sandboxing
if not success then return false, msg end
if type(env.port) ~= "table" then
return false, "Ports set are invalid."
return false, S("Ports set are invalid.")
end
-- Actually set the ports