aboutsummaryrefslogtreecommitdiff
path: root/advtrains_luaautomation
diff options
context:
space:
mode:
authorY. Wang <yw05@forksworld.de>2023-10-04 22:14:18 +0200
committerY. Wang <y5nw@protonmail.com>2024-11-04 17:17:52 +0100
commiteb0c5b78627505bcba409dc5f52dbb05891954c5 (patch)
tree1a9dc00e6ce6a7f64cbdd913c5b49099f3abf992 /advtrains_luaautomation
parent425b0993d355b9f45ddd400bd4925f9f1a5bd34d (diff)
downloadadvtrains-eb0c5b78627505bcba409dc5f52dbb05891954c5.tar.gz
advtrains-eb0c5b78627505bcba409dc5f52dbb05891954c5.tar.bz2
advtrains-eb0c5b78627505bcba409dc5f52dbb05891954c5.zip
Various translation improvements
Diffstat (limited to 'advtrains_luaautomation')
-rw-r--r--advtrains_luaautomation/active_common.lua20
-rw-r--r--advtrains_luaautomation/atc_rail.lua2
-rw-r--r--advtrains_luaautomation/init.lua6
-rw-r--r--advtrains_luaautomation/mesecon_controller.lua3
-rw-r--r--advtrains_luaautomation/operation_panel.lua3
-rw-r--r--advtrains_luaautomation/pcnaming.lua8
6 files changed, 23 insertions, 19 deletions
diff --git a/advtrains_luaautomation/active_common.lua b/advtrains_luaautomation/active_common.lua
index 50fb2bc..1a7009f 100644
--- a/advtrains_luaautomation/active_common.lua
+++ b/advtrains_luaautomation/active_common.lua
@@ -1,4 +1,4 @@
-
+local S = atltrans
local ac = {nodes={}}
@@ -14,7 +14,7 @@ end
function ac.after_place_node(pos, player)
local meta=minetest.get_meta(pos)
meta:set_string("formspec", ac.getform(pos, meta))
- meta:set_string("infotext", "LuaATC component, unconfigured.")
+ meta:set_string("infotext", S("Unconfigured LuaATC component"))
local ph=minetest.pos_to_string(pos)
--just get first available key!
for en,_ in pairs(atlatc.envs) do
@@ -43,11 +43,11 @@ function ac.getform(pos, meta_p)
end
local form = "size["..atlatc.CODE_FORM_SIZE.."]"
.."style[code;font=mono]"
- .."label[0,-0.1;Environment]"
+ .."label[0,-0.1;"..S("LuaATC Environment").."]"
.."dropdown[0,0.3;3;env;"..table.concat(envs_asvalues, ",")..";"..sel.."]"
- .."button[5,0.2;2,1;save;Save]"
- .."button[7,0.2;3,1;cle;Clear Local Env.]"
- .."textarea[0.3,1.5;"..atlatc.CODE_FORM_SIZE..";code;Code;"..minetest.formspec_escape(code).."]"
+ .."button[5,0.2;2,1;save;"..S("Save").."]"
+ .."button[7,0.2;3,1;cle;"..S("Clear Local Environment").."]"
+ .."textarea[0.3,1.5;"..atlatc.CODE_FORM_SIZE..";code;"..S("Code")..";"..minetest.formspec_escape(code).."]"
.."label["..atlatc.CODE_FORM_ERRLABELPOS..";"..err.."]"
return form
end
@@ -61,7 +61,7 @@ end
function ac.on_receive_fields(pos, formname, fields, player)
if not minetest.check_player_privs(player:get_player_name(), {atlatc=true}) then
- minetest.chat_send_player(player:get_player_name(), "Missing privilege: atlatc - Operation cancelled!")
+ minetest.chat_send_player(player:get_player_name(), S("You are not allowed to configure this LuaATC component without the @1 privilege.", "atlatc"))
return
end
@@ -91,9 +91,9 @@ function ac.on_receive_fields(pos, formname, fields, player)
meta:set_string("formspec", ac.getform(pos, meta))
if nodetbl.env then
- meta:set_string("infotext", "LuaATC component, assigned to environment '"..nodetbl.env.."'")
+ meta:set_string("infotext", S("LuaATC component assigned to environment '@1'", nodetbl.env))
else
- meta:set_string("infotext", "LuaATC component, invalid enviroment set!")
+ meta:set_string("infotext", S("LuaATC component assigned to an invalid environment"))
end
end
@@ -168,7 +168,7 @@ function ac.run_in_env(pos, evtdata, customfct_p, ignore_no_code)
atlatc.active.nodes[ph].err=dataout
env:log("error", "LuaATC component at",ph,": LUA Error:",dataout)
if meta then
- meta:set_string("infotext", "LuaATC component, ERROR:"..dataout)
+ meta:set_string("infotext", S("LuaATC component with error: @1", dataout))
end
--TODO temporary
--if customfct.atc_id then
diff --git a/advtrains_luaautomation/atc_rail.lua b/advtrains_luaautomation/atc_rail.lua
index b98648e..f6a7823 100644
--- a/advtrains_luaautomation/atc_rail.lua
+++ b/advtrains_luaautomation/atc_rail.lua
@@ -220,7 +220,7 @@ advtrains.register_tracks("default", {
models_prefix="advtrains_dtrack",
models_suffix=".b3d",
shared_texture="advtrains_dtrack_shared_atc.png",
- description=atltrans("LuaATC Rail"),
+ description=atltrans("LuaATC Track"),
formats={},
get_additional_definiton = function(def, preset, suffix, rotation)
return {
diff --git a/advtrains_luaautomation/init.lua b/advtrains_luaautomation/init.lua
index c51aa71..b359142 100644
--- a/advtrains_luaautomation/init.lua
+++ b/advtrains_luaautomation/init.lua
@@ -2,15 +2,15 @@
-- Lua automation features for advtrains
-- Uses global table 'atlatc' (AdvTrains_LuaATC)
---TODO: re-add localization (if merging localization, discard this hunk please)
-atltrans = function(s,a,...)a={a,...}return s:gsub("@(%d+)",function(n)return a[tonumber(n)]end)end
+atltrans = attrans
+local S = atltrans
--Privilege
--Only trusted players should be enabled to build stuff which can break the server.
atlatc = { envs = {}}
-minetest.register_privilege("atlatc", { description = "Player can place and modify LUA ATC components. Grant with care! Allows to execute bad LUA code.", give_to_singleplayer = false, default= false })
+minetest.register_privilege("atlatc", { description = S("Can place and configure LuaATC components, including execute potentially harmful Lua code"), give_to_singleplayer = false, default= false })
--Size of code input forms in X,Y notation. Must be at least 10x10
atlatc.CODE_FORM_SIZE = "15,12"
diff --git a/advtrains_luaautomation/mesecon_controller.lua b/advtrains_luaautomation/mesecon_controller.lua
index bffff84..6981839 100644
--- a/advtrains_luaautomation/mesecon_controller.lua
+++ b/advtrains_luaautomation/mesecon_controller.lua
@@ -6,6 +6,7 @@
-- From Mesecons mod https://mesecons.net/
-- (c) Jeija and Contributors
+local S = atltrans
local BASENAME = "advtrains_luaautomation:mesecon_controller"
local rules = {
@@ -207,7 +208,7 @@ for d = 0, 1 do
}
minetest.register_node(node_name, {
- description = "LuaATC Mesecon Controller",
+ description = S("LuaATC Mesecon Controller"),
drawtype = "nodebox",
tiles = {
top,
diff --git a/advtrains_luaautomation/operation_panel.lua b/advtrains_luaautomation/operation_panel.lua
index c118ff3..8e12651 100644
--- a/advtrains_luaautomation/operation_panel.lua
+++ b/advtrains_luaautomation/operation_panel.lua
@@ -1,3 +1,4 @@
+local S = atltrans
local function on_punch(pos,node,player)
atlatc.interrupt.add(0, pos, {type="punch", punch=true, name=player:get_player_name()})
@@ -7,7 +8,7 @@ end
minetest.register_node("advtrains_luaautomation:oppanel", {
drawtype = "normal",
tiles={"atlatc_oppanel.png"},
- description = "LuaATC operation panel",
+ description = S("LuaATC Operation Panel"),
groups = {
cracky = 1,
save_in_at_nodedb=1,
diff --git a/advtrains_luaautomation/pcnaming.lua b/advtrains_luaautomation/pcnaming.lua
index 5624b74..0089ae7 100644
--- a/advtrains_luaautomation/pcnaming.lua
+++ b/advtrains_luaautomation/pcnaming.lua
@@ -2,6 +2,8 @@
--a.k.a Passive component naming
--Allows to assign names to passive components, so they can be called like:
--setstate("iamasignal", "green")
+local S = atltrans
+
atlatc.pcnaming={name_map={}}
function atlatc.pcnaming.load(stuff)
if type(stuff)=="table" then
@@ -26,7 +28,7 @@ end
local pcrename = {}
minetest.register_craftitem("advtrains_luaautomation:pcnaming",{
- description = attrans("Passive Component Naming Tool\n\nRight-click to name a passive component."),
+ description = S("Passive Component Naming Tool\n\nRight-click to name a passive component."),
groups = {cracky=1}, -- key=name, value=rating; rating=1..3.
inventory_image = "atlatc_pcnaming.png",
wield_image = "atlatc_pcnaming.png",
@@ -37,7 +39,7 @@ minetest.register_craftitem("advtrains_luaautomation:pcnaming",{
return
end
if not minetest.check_player_privs(pname, {atlatc=true}) then
- minetest.chat_send_player(pname, "Missing privilege: atlatc")
+ minetest.chat_send_player(pname, S("You are not allowed to name LuaATC passive components without the @1 privilege.", "atlatc"))
return
end
if pointed_thing.type=="node" then
@@ -62,7 +64,7 @@ minetest.register_craftitem("advtrains_luaautomation:pcnaming",{
end
end
pcrename[pname] = pos
- minetest.show_formspec(pname, "atlatc_naming", "field[pn;Set name of component (empty to clear);"..minetest.formspec_escape(pn).."]")
+ minetest.show_formspec(pname, "atlatc_naming", "field[pn;"..S("Set name of component (empty to clear)")..";"..minetest.formspec_escape(pn).."]")
end
end
end,