From f5df3bb5edba282381d7e279f1abe4b4b4cefa33 Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Fri, 23 Aug 2019 05:22:16 +0200 Subject: [PATCH] Add MT 5.0.0 translation support --- mesecons_blinkyplant/init.lua | 4 ++- mesecons_button/init.lua | 6 ++-- mesecons_commandblock/init.lua | 54 +++++++++++++++++-------------- mesecons_delayer/init.lua | 6 ++-- mesecons_detector/init.lua | 13 +++++--- mesecons_extrawires/corner.lua | 3 +- mesecons_extrawires/crossover.lua | 10 +++--- mesecons_extrawires/tjunction.lua | 4 ++- mesecons_extrawires/vertical.lua | 8 +++-- mesecons_fpga/init.lua | 4 ++- mesecons_gates/init.lua | 21 +++++++----- mesecons_hydroturbine/init.lua | 6 ++-- mesecons_insulated/init.lua | 6 ++-- mesecons_lamp/init.lua | 4 ++- mesecons_lightstone/init.lua | 28 ++++++++-------- mesecons_luacontroller/init.lua | 6 +++- mesecons_materials/init.lua | 8 +++-- mesecons_microcontroller/init.lua | 51 +++++++++++++++-------------- mesecons_movestones/init.lua | 10 +++--- mesecons_noteblock/init.lua | 4 ++- mesecons_pistons/init.lua | 14 ++++---- mesecons_powerplant/init.lua | 4 ++- mesecons_pressureplates/init.lua | 6 ++-- mesecons_random/init.lua | 6 ++-- mesecons_solarpanel/init.lua | 4 ++- mesecons_stickyblocks/init.lua | 4 ++- mesecons_switch/init.lua | 4 ++- mesecons_torch/init.lua | 4 ++- mesecons_walllever/init.lua | 4 ++- mesecons_wires/init.lua | 4 ++- 30 files changed, 189 insertions(+), 121 deletions(-) diff --git a/mesecons_blinkyplant/init.lua b/mesecons_blinkyplant/init.lua index 14a274f..867aa9b 100644 --- a/mesecons_blinkyplant/init.lua +++ b/mesecons_blinkyplant/init.lua @@ -1,3 +1,5 @@ +local S = minetest.get_translator("mesecons_blinkyplant") + -- The BLINKY_PLANT local toggle_timer = function (pos) @@ -20,7 +22,7 @@ local on_timer = function (pos) end mesecon.register_node("mesecons_blinkyplant:blinky_plant", { - description="Blinky Plant", + description=S("Blinky Plant"), drawtype = "plantlike", inventory_image = "jeija_blinky_plant_off.png", paramtype = "light", diff --git a/mesecons_button/init.lua b/mesecons_button/init.lua index 8764fbc..65286c2 100644 --- a/mesecons_button/init.lua +++ b/mesecons_button/init.lua @@ -1,3 +1,5 @@ +local S = minetest.get_translator("mesecons_button") + -- WALL BUTTON -- A button that when pressed emits power for 1 second -- and then turns off again @@ -42,7 +44,7 @@ minetest.register_node("mesecons_button:button_off", { } }, groups = {dig_immediate=2, mesecon_needs_receiver = 1}, - description = "Button", + description = S("Button"), on_rightclick = function (pos, node) minetest.swap_node(pos, {name = "mesecons_button:button_on", param2=node.param2}) mesecon.receptor_on(pos, mesecon.rules.buttonlike_get(node)) @@ -88,7 +90,7 @@ minetest.register_node("mesecons_button:button_on", { }, groups = {dig_immediate=2, not_in_creative_inventory=1, mesecon_needs_receiver = 1}, drop = 'mesecons_button:button_off', - description = "Button", + description = S("Button"), sounds = default.node_sound_stone_defaults(), mesecons = {receptor = { state = mesecon.state.on, diff --git a/mesecons_commandblock/init.lua b/mesecons_commandblock/init.lua index 326b8ae..2a6e563 100644 --- a/mesecons_commandblock/init.lua +++ b/mesecons_commandblock/init.lua @@ -1,6 +1,9 @@ +local S = minetest.get_translator("mesecons_commandblock") +local F = minetest.formspec_escape + minetest.register_chatcommand("say", { - params = "", - description = "Say as the server", + params = S(""), + description = S("Say as the server"), privs = {server=true}, func = function(name, param) minetest.chat_send_all(name .. ": " .. param) @@ -8,36 +11,36 @@ minetest.register_chatcommand("say", { }) minetest.register_chatcommand("tell", { - params = " ", - description = "Say to privately", + params = S(" "), + description = S("Say to privately"), func = function(name, param) local found, _, target, message = param:find("^([^%s]+)%s+(.*)$") if found == nil then - minetest.chat_send_player(name, "Invalid usage: " .. param) + minetest.chat_send_player(name, S("Invalid usage: @1", param)) return end if not minetest.get_player_by_name(target) then - minetest.chat_send_player(name, "Invalid target: " .. target) + minetest.chat_send_player(name, S("Invalid target: @1", target)) end - minetest.chat_send_player(target, name .. " whispers: " .. message, false) + minetest.chat_send_player(target, S("@1 whispers: @2", name, message), false) end }) minetest.register_chatcommand("hp", { - params = " ", - description = "Set health of to hitpoints", + params = S(" "), + description = S("Set health of to hitpoints"), privs = {ban=true}, func = function(name, param) local found, _, target, value = param:find("^([^%s]+)%s+(%d+)$") if found == nil then - minetest.chat_send_player(name, "Invalid usage: " .. param) + minetest.chat_send_player(name, S("Invalid usage: @1", param)) return end local player = minetest.get_player_by_name(target) if player then player:set_hp(value) else - minetest.chat_send_player(name, "Invalid target: " .. target) + minetest.chat_send_player(name, S("Invalid target: @1", target)) end end }) @@ -46,18 +49,19 @@ local function initialize_data(meta) local commands = minetest.formspec_escape(meta:get_string("commands")) meta:set_string("formspec", "invsize[9,5;]" .. - "textarea[0.5,0.5;8.5,4;commands;Commands;"..commands.."]" .. - "label[1,3.8;@nearest, @farthest, and @random are replaced by the respective player names]" .. - "button_exit[3.3,4.5;2,1;submit;Submit]") + "textarea[0.5,0.5;8.5,4;commands;"..F(S("Commands"))..";"..commands.."]" .. + "label[1,3.8;"..F(S("@nearest, @farthest, and @random are replaced by the respective player names"))"]" .. + "button_exit[3.3,4.5;2,1;submit;"..F(S("Submit")).."]") local owner = meta:get_string("owner") + local ownstr = "" if owner == "" then - owner = "not owned" + ownstr = S("(not owned)") else - owner = "owned by " .. owner + ownstr = S("(owned by @1)", owner) end - meta:set_string("infotext", "Command Block\n" .. - "(" .. owner .. ")\n" .. - "Commands: "..commands) + meta:set_string("infotext", S("Command Block").."\n" .. + ownstr .. "\n" .. + S("Commands: @1", commands)) end local function construct(pos) @@ -150,15 +154,15 @@ local function commandblock_action_on(pos, node) end local cmddef = minetest.chatcommands[cmd] if not cmddef then - minetest.chat_send_player(owner, "The command "..cmd.." does not exist") + minetest.chat_send_player(owner, S("The command @1 does not exist", cmd)) return end local has_privs, missing_privs = minetest.check_player_privs(owner, cmddef.privs) if not has_privs then - minetest.chat_send_player(owner, "You don't have permission " - .."to run "..cmd - .." (missing privileges: " - ..table.concat(missing_privs, ", ")..")") + minetest.chat_send_player(owner, + S("You don't have permission to run @1 (missing privileges: @2)", + cmd, + table.concat(missing_privs, ", "))) return end cmddef.func(owner, param) @@ -178,7 +182,7 @@ local function can_dig(pos, player) end minetest.register_node("mesecons_commandblock:commandblock_off", { - description = "Command Block", + description = S("Command Block"), tiles = {"jeija_commandblock_off.png"}, inventory_image = minetest.inventorycube("jeija_commandblock_off.png"), is_ground_content = false, diff --git a/mesecons_delayer/init.lua b/mesecons_delayer/init.lua index 94450db..86cf407 100644 --- a/mesecons_delayer/init.lua +++ b/mesecons_delayer/init.lua @@ -1,3 +1,5 @@ +local S = minetest.get_translator("mesecons_delayer") + -- Function that get the input/output rules of the delayer local delayer_get_output_rules = function(node) local rules = {{x = 0, y = 0, z = 1}} @@ -62,7 +64,7 @@ local boxes = { } minetest.register_node("mesecons_delayer:delayer_off_"..tostring(i), { - description = "Delayer", + description = S("Delayer"), drawtype = "nodebox", tiles = { "mesecons_delayer_off_"..tostring(i)..".png", @@ -120,7 +122,7 @@ minetest.register_node("mesecons_delayer:delayer_off_"..tostring(i), { minetest.register_node("mesecons_delayer:delayer_on_"..tostring(i), { - description = "You hacker you", + description = S("You hacker you"), drawtype = "nodebox", tiles = { "mesecons_delayer_on_"..tostring(i)..".png", diff --git a/mesecons_detector/init.lua b/mesecons_detector/init.lua index cdc7f92..6a8be39 100644 --- a/mesecons_detector/init.lua +++ b/mesecons_detector/init.lua @@ -1,3 +1,6 @@ +local S = minetest.get_translator("mesecons_detector") +local F = minetest.formspec_escape + local GET_COMMAND = "GET" -- Object detector @@ -7,9 +10,9 @@ local GET_COMMAND = "GET" local function object_detector_make_formspec(pos) local meta = minetest.get_meta(pos) meta:set_string("formspec", "size[9,2.5]" .. - "field[0.3, 0;9,2;scanname;Name of player to scan for (empty for any):;${scanname}]".. - "field[0.3,1.5;4,2;digiline_channel;Digiline Channel (optional):;${digiline_channel}]".. - "button_exit[7,0.75;2,3;;Save]") + "field[0.3, 0;9,2;scanname;"..F(S("Name of player to scan for (empty for any):"))..";${scanname}]".. + "field[0.3,1.5;4,2;digiline_channel;"..F(S("Digiline Channel (optional):"))..";${digiline_channel}]".. + "button_exit[7,0.75;2,3;;"..F(S("Save")).."]") end local function object_detector_on_receive_fields(pos, formname, fields, sender) @@ -69,7 +72,7 @@ minetest.register_node("mesecons_detector:object_detector_off", { is_ground_content = false, walkable = true, groups = {cracky=3}, - description="Player Detector", + description=S("Player Detector"), mesecons = {receptor = { state = mesecon.state.off, rules = mesecon.rules.pplate @@ -262,7 +265,7 @@ minetest.register_node("mesecons_detector:node_detector_off", { is_ground_content = false, walkable = true, groups = {cracky=3}, - description="Node Detector", + description=S("Node Detector"), mesecons = {receptor = { state = mesecon.state.off }}, diff --git a/mesecons_extrawires/corner.lua b/mesecons_extrawires/corner.lua index d33447a..a8b2a99 100644 --- a/mesecons_extrawires/corner.lua +++ b/mesecons_extrawires/corner.lua @@ -1,3 +1,4 @@ +local S = minetest.get_translator("mesecons_extrawires") local screwdriver_exists = minetest.global_exists("screwdriver") local corner_nodebox = { @@ -56,7 +57,7 @@ minetest.register_node("mesecons_extrawires:corner_on", { minetest.register_node("mesecons_extrawires:corner_off", { drawtype = "nodebox", - description = "Insulated Mesecon Corner", + description = S("Insulated Mesecon Corner"), tiles = { "jeija_insulated_wire_curved_tb_off.png", "jeija_insulated_wire_curved_tb_off.png^[transformR270", diff --git a/mesecons_extrawires/crossover.lua b/mesecons_extrawires/crossover.lua index 2656d61..0c2cd2d 100644 --- a/mesecons_extrawires/crossover.lua +++ b/mesecons_extrawires/crossover.lua @@ -1,3 +1,5 @@ +local S = minetest.get_translator("mesecons_extrawires") + local function crossover_get_rules(node) return { {--first wire @@ -19,7 +21,7 @@ local crossover_states = { } minetest.register_node("mesecons_extrawires:crossover_off", { - description = "Insulated Mesecon Crossover", + description = S("Insulated Mesecon Crossover"), drawtype = "mesh", mesh = "mesecons_extrawires_crossover.b3d", tiles = { @@ -45,7 +47,7 @@ minetest.register_node("mesecons_extrawires:crossover_off", { }) minetest.register_node("mesecons_extrawires:crossover_01", { - description = "You hacker you!", + description = S("You hacker you!"), drop = "mesecons_extrawires:crossover_off", drawtype = "mesh", mesh = "mesecons_extrawires_crossover.b3d", @@ -72,7 +74,7 @@ minetest.register_node("mesecons_extrawires:crossover_01", { }) minetest.register_node("mesecons_extrawires:crossover_10", { - description = "You hacker you!", + description = S("You hacker you!"), drop = "mesecons_extrawires:crossover_off", drawtype = "mesh", mesh = "mesecons_extrawires_crossover.b3d", @@ -99,7 +101,7 @@ minetest.register_node("mesecons_extrawires:crossover_10", { }) minetest.register_node("mesecons_extrawires:crossover_on", { - description = "You hacker you!", + description = S("You hacker you!"), drop = "mesecons_extrawires:crossover_off", drawtype = "mesh", mesh = "mesecons_extrawires_crossover.b3d", diff --git a/mesecons_extrawires/tjunction.lua b/mesecons_extrawires/tjunction.lua index 77c4290..418ce44 100644 --- a/mesecons_extrawires/tjunction.lua +++ b/mesecons_extrawires/tjunction.lua @@ -1,3 +1,5 @@ +local S = minetest.get_translator("mesecons_extrawires") + local screwdriver_exists = minetest.global_exists("screwdriver") local tjunction_nodebox = { @@ -57,7 +59,7 @@ minetest.register_node("mesecons_extrawires:tjunction_on", { minetest.register_node("mesecons_extrawires:tjunction_off", { drawtype = "nodebox", - description = "Insulated Mesecon T-junction", + description = S("Insulated Mesecon T-junction"), tiles = { "jeija_insulated_wire_tjunction_tb_off.png", "jeija_insulated_wire_tjunction_tb_off.png^[transformR180", diff --git a/mesecons_extrawires/vertical.lua b/mesecons_extrawires/vertical.lua index 1543194..d631202 100644 --- a/mesecons_extrawires/vertical.lua +++ b/mesecons_extrawires/vertical.lua @@ -1,3 +1,5 @@ +local S = minetest.get_translator("mesecons_extrawires") + local vertical_box = { type = "fixed", fixed = {-1/16, -8/16, -1/16, 1/16, 8/16, 1/16} @@ -77,7 +79,7 @@ end -- Vertical wire mesecon.register_node("mesecons_extrawires:vertical", { - description = "Vertical Mesecon", + description = S("Vertical Mesecon"), drawtype = "nodebox", walkable = false, paramtype = "light", @@ -110,7 +112,7 @@ mesecon.register_node("mesecons_extrawires:vertical", { -- Vertical wire top mesecon.register_node("mesecons_extrawires:vertical_top", { - description = "Vertical mesecon", + description = S("Vertical mesecon"), drawtype = "nodebox", walkable = false, paramtype = "light", @@ -142,7 +144,7 @@ mesecon.register_node("mesecons_extrawires:vertical_top", { -- Vertical wire bottom mesecon.register_node("mesecons_extrawires:vertical_bottom", { - description = "Vertical mesecon", + description = S("Vertical mesecon"), drawtype = "nodebox", walkable = false, paramtype = "light", diff --git a/mesecons_fpga/init.lua b/mesecons_fpga/init.lua index 941b61a..e79022f 100644 --- a/mesecons_fpga/init.lua +++ b/mesecons_fpga/init.lua @@ -1,3 +1,5 @@ +local S = minetest.get_translator("mesecons_fpga") + local plg = {} plg.rules = {} @@ -58,7 +60,7 @@ plg.register_nodes = function(template) end plg.register_nodes({ - description = "FPGA", + description = S("FPGA"), drawtype = "nodebox", tiles = { "", -- replaced later diff --git a/mesecons_gates/init.lua b/mesecons_gates/init.lua index 421a7d4..23900a5 100644 --- a/mesecons_gates/init.lua +++ b/mesecons_gates/init.lua @@ -1,3 +1,5 @@ +local S = minetest.get_translator("mesecons_gates") + local nodebox = { type = "fixed", fixed = {{-8/16, -8/16, -8/16, 8/16, -7/16, 8/16 }}, @@ -57,7 +59,10 @@ end local function register_gate(name, inputnumber, assess, recipe, description) local get_inputrules = inputnumber == 2 and gate_get_input_rules_twoinputs or gate_get_input_rules_oneinput - description = "Logic Gate: "..name + + if not description then + description = S("Logic Gate: @1", name) + end local basename = "mesecons_gates:"..name mesecon.register_node(basename, { @@ -106,38 +111,38 @@ end register_gate("diode", 1, function (input) return input end, {{"mesecons:mesecon", "mesecons_torch:mesecon_torch_on", "mesecons_torch:mesecon_torch_on"}}, - "Diode") + S("Diode")) register_gate("not", 1, function (input) return not input end, {{"mesecons:mesecon", "mesecons_torch:mesecon_torch_on", "mesecons:mesecon"}}, - "NOT Gate") + S("NOT Gate")) register_gate("and", 2, function (val1, val2) return val1 and val2 end, {{"mesecons:mesecon", "", ""}, {"", "mesecons_materials:silicon", "mesecons:mesecon"}, {"mesecons:mesecon", "", ""}}, - "AND Gate") + S("AND Gate")) register_gate("nand", 2, function (val1, val2) return not (val1 and val2) end, {{"mesecons:mesecon", "", ""}, {"", "mesecons_materials:silicon", "mesecons_torch:mesecon_torch_on"}, {"mesecons:mesecon", "", ""}}, - "NAND Gate") + S("NAND Gate")) register_gate("xor", 2, function (val1, val2) return (val1 or val2) and not (val1 and val2) end, {{"mesecons:mesecon", "", ""}, {"", "mesecons_materials:silicon", "mesecons_materials:silicon"}, {"mesecons:mesecon", "", ""}}, - "XOR Gate") + S("XOR Gate")) register_gate("nor", 2, function (val1, val2) return not (val1 or val2) end, {{"mesecons:mesecon", "", ""}, {"", "mesecons:mesecon", "mesecons_torch:mesecon_torch_on"}, {"mesecons:mesecon", "", ""}}, - "NOR Gate") + S("NOR Gate")) register_gate("or", 2, function (val1, val2) return (val1 or val2) end, {{"mesecons:mesecon", "", ""}, {"", "mesecons:mesecon", "mesecons:mesecon"}, {"mesecons:mesecon", "", ""}}, - "OR Gate") + S("OR Gate")) diff --git a/mesecons_hydroturbine/init.lua b/mesecons_hydroturbine/init.lua index afa21e9..7d1190f 100644 --- a/mesecons_hydroturbine/init.lua +++ b/mesecons_hydroturbine/init.lua @@ -1,3 +1,5 @@ +local S = minetest.get_translator("mesecons_hydroturbine") + -- HYDRO_TURBINE -- Water turbine: -- Active if flowing >water< above it @@ -16,7 +18,7 @@ minetest.register_node("mesecons_hydroturbine:hydro_turbine_off", { is_ground_content = false, wield_scale = {x=0.75, y=0.75, z=0.75}, groups = {dig_immediate=2}, - description="Water Turbine", + description=S("Water Turbine"), paramtype = "light", selection_box = { type = "fixed", @@ -45,7 +47,7 @@ minetest.register_node("mesecons_hydroturbine:hydro_turbine_on", { inventory_image = "jeija_hydro_turbine_inv.png", drop = "mesecons_hydroturbine:hydro_turbine_off 1", groups = {dig_immediate=2,not_in_creative_inventory=1}, - description="Water Turbine", + description=S("Water Turbine"), paramtype = "light", selection_box = { type = "fixed", diff --git a/mesecons_insulated/init.lua b/mesecons_insulated/init.lua index ca55b9a..49bb34e 100644 --- a/mesecons_insulated/init.lua +++ b/mesecons_insulated/init.lua @@ -1,3 +1,5 @@ +local S = minetest.get_translator("mesecons_hydroturbine") + local screwdriver_exists = minetest.global_exists("screwdriver") local function insulated_wire_get_rules(node) @@ -11,7 +13,7 @@ end minetest.register_node("mesecons_insulated:insulated_on", { drawtype = "nodebox", - description = "Straight Insulated Mesecon", + description = S("Straight Insulated Mesecon"), tiles = { "jeija_insulated_wire_sides_on.png", "jeija_insulated_wire_sides_on.png", @@ -48,7 +50,7 @@ minetest.register_node("mesecons_insulated:insulated_on", { minetest.register_node("mesecons_insulated:insulated_off", { drawtype = "nodebox", - description = "Straight Insulated Mesecon", + description = S("Straight Insulated Mesecon"), tiles = { "jeija_insulated_wire_sides_off.png", "jeija_insulated_wire_sides_off.png", diff --git a/mesecons_lamp/init.lua b/mesecons_lamp/init.lua index 14a3659..37d2318 100644 --- a/mesecons_lamp/init.lua +++ b/mesecons_lamp/init.lua @@ -1,3 +1,5 @@ +local S = minetest.get_translator("mesecons_lamp") + -- MESELAMPS -- A lamp is "is an electrical device used to create artificial light" (wikipedia) -- guess what? @@ -46,7 +48,7 @@ minetest.register_node("mesecons_lamp:lamp_off", { node_box = mesecon_lamp_box, selection_box = mesecon_lamp_box, groups = {dig_immediate=3, mesecon_receptor_off = 1, mesecon_effector_off = 1}, - description = "Mesecon Lamp", + description = S("Mesecon Lamp"), sounds = default.node_sound_glass_defaults(), mesecons = {effector = { action_on = function (pos, node) diff --git a/mesecons_lightstone/init.lua b/mesecons_lightstone/init.lua index 4e56ba2..1bedaf9 100644 --- a/mesecons_lightstone/init.lua +++ b/mesecons_lightstone/init.lua @@ -1,3 +1,5 @@ +local S = minetest.get_translator("mesecons_lightstone") + local lightstone_rules = { {x=0, y=0, z=-1}, {x=1, y=0, z=0}, @@ -16,7 +18,7 @@ local lightstone_rules = { function mesecon.lightstone_add(name, base_item, texture_off, texture_on, desc) if not desc then - desc = name .. " Lightstone" + desc = S("Lightstone (@1)", name) end minetest.register_node("mesecons_lightstone:lightstone_" .. name .. "_off", { tiles = {texture_off}, @@ -59,15 +61,15 @@ function mesecon.lightstone_add(name, base_item, texture_off, texture_on, desc) end -mesecon.lightstone_add("red", "dye:red", "jeija_lightstone_red_off.png", "jeija_lightstone_red_on.png", "Red Lightstone") -mesecon.lightstone_add("green", "dye:green", "jeija_lightstone_green_off.png", "jeija_lightstone_green_on.png", "Green Lightstone") -mesecon.lightstone_add("blue", "dye:blue", "jeija_lightstone_blue_off.png", "jeija_lightstone_blue_on.png", "Blue Lightstone") -mesecon.lightstone_add("gray", "dye:grey", "jeija_lightstone_gray_off.png", "jeija_lightstone_gray_on.png", "Grey Lightstone") -mesecon.lightstone_add("darkgray", "dye:dark_grey", "jeija_lightstone_darkgray_off.png", "jeija_lightstone_darkgray_on.png", "Dark Grey Lightstone") -mesecon.lightstone_add("yellow", "dye:yellow", "jeija_lightstone_yellow_off.png", "jeija_lightstone_yellow_on.png", "Yellow Lightstone") -mesecon.lightstone_add("orange", "dye:orange", "jeija_lightstone_orange_off.png", "jeija_lightstone_orange_on.png", "Orange Lightstone") -mesecon.lightstone_add("white", "dye:white", "jeija_lightstone_white_off.png", "jeija_lightstone_white_on.png", "White Lightstone") -mesecon.lightstone_add("pink", "dye:pink", "jeija_lightstone_pink_off.png", "jeija_lightstone_pink_on.png", "Pink Lightstone") -mesecon.lightstone_add("magenta", "dye:magenta", "jeija_lightstone_magenta_off.png", "jeija_lightstone_magenta_on.png", "Magenta Lightstone") -mesecon.lightstone_add("cyan", "dye:cyan", "jeija_lightstone_cyan_off.png", "jeija_lightstone_cyan_on.png", "Cyan Lightstone") -mesecon.lightstone_add("violet", "dye:violet", "jeija_lightstone_violet_off.png", "jeija_lightstone_violet_on.png", "Violet Lightstone") +mesecon.lightstone_add("red", "dye:red", "jeija_lightstone_red_off.png", "jeija_lightstone_red_on.png", S("Red Lightstone")) +mesecon.lightstone_add("green", "dye:green", "jeija_lightstone_green_off.png", "jeija_lightstone_green_on.png", S("Green Lightstone")) +mesecon.lightstone_add("blue", "dye:blue", "jeija_lightstone_blue_off.png", "jeija_lightstone_blue_on.png", S("Blue Lightstone")) +mesecon.lightstone_add("gray", "dye:grey", "jeija_lightstone_gray_off.png", "jeija_lightstone_gray_on.png", S("Grey Lightstone")) +mesecon.lightstone_add("darkgray", "dye:dark_grey", "jeija_lightstone_darkgray_off.png", "jeija_lightstone_darkgray_on.png", S("Dark Grey Lightstone")) +mesecon.lightstone_add("yellow", "dye:yellow", "jeija_lightstone_yellow_off.png", "jeija_lightstone_yellow_on.png", S("Yellow Lightstone")) +mesecon.lightstone_add("orange", "dye:orange", "jeija_lightstone_orange_off.png", "jeija_lightstone_orange_on.png", S("Orange Lightstone")) +mesecon.lightstone_add("white", "dye:white", "jeija_lightstone_white_off.png", "jeija_lightstone_white_on.png", S("White Lightstone")) +mesecon.lightstone_add("pink", "dye:pink", "jeija_lightstone_pink_off.png", "jeija_lightstone_pink_on.png", S("Pink Lightstone")) +mesecon.lightstone_add("magenta", "dye:magenta", "jeija_lightstone_magenta_off.png", "jeija_lightstone_magenta_on.png", S("Magenta Lightstone")) +mesecon.lightstone_add("cyan", "dye:cyan", "jeija_lightstone_cyan_off.png", "jeija_lightstone_cyan_on.png", S("Cyan Lightstone")) +mesecon.lightstone_add("violet", "dye:violet", "jeija_lightstone_violet_off.png", "jeija_lightstone_violet_on.png", S("Violet Lightstone")) diff --git a/mesecons_luacontroller/init.lua b/mesecons_luacontroller/init.lua index 1c93e48..6902340 100644 --- a/mesecons_luacontroller/init.lua +++ b/mesecons_luacontroller/init.lua @@ -1,3 +1,5 @@ +local S = minetest.get_translator("mesecons_luacontroller") + -- ______ -- | -- | @@ -632,9 +634,11 @@ local function reset_formspec(meta, code, errmsg) code = minetest.formspec_escape(code or "") errmsg = minetest.formspec_escape(tostring(errmsg or "")) meta:set_string("formspec", "size[12,10]" + -- FIXME: The background includes untranslatable English text .."background[-0.2,-0.25;12.4,10.75;jeija_luac_background.png]" .."label[0.1,8.3;"..errmsg.."]" .."textarea[0.2,0.2;12.2,9.5;code;;"..code.."]" + -- FIXME: This image include untranslatable English text .."image_button[4.75,8.75;2.5,1;jeija_luac_runbutton.png;program;]" .."image_button_exit[11.72,-0.25;0.425,0.4;jeija_close_window.png;exit;]" ) @@ -807,7 +811,7 @@ for d = 0, 1 do } minetest.register_node(node_name, { - description = "Luacontroller", + description = S("Luacontroller"), drawtype = "nodebox", tiles = { top, diff --git a/mesecons_materials/init.lua b/mesecons_materials/init.lua index eb19c3e..a73ddac 100644 --- a/mesecons_materials/init.lua +++ b/mesecons_materials/init.lua @@ -1,14 +1,16 @@ +local S = minetest.get_translator("mesecons_materials") + -- Glue and fiber minetest.register_craftitem("mesecons_materials:glue", { image = "mesecons_glue.png", on_place_on_ground = minetest.craftitem_place_item, - description="Glue", + description=S("Glue"), }) minetest.register_craftitem("mesecons_materials:fiber", { image = "mesecons_fiber.png", on_place_on_ground = minetest.craftitem_place_item, - description="Fiber", + description=S("Fiber"), }) minetest.register_craft({ @@ -29,7 +31,7 @@ minetest.register_craft({ minetest.register_craftitem("mesecons_materials:silicon", { image = "mesecons_silicon.png", on_place_on_ground = minetest.craftitem_place_item, - description="Silicon", + description=S("Silicon"), }) minetest.register_craft({ diff --git a/mesecons_microcontroller/init.lua b/mesecons_microcontroller/init.lua index f9ba979..99fe220 100644 --- a/mesecons_microcontroller/init.lua +++ b/mesecons_microcontroller/init.lua @@ -1,3 +1,6 @@ +local S = minetest.get_translator("mesecons_microcontroller") +local F = minetest.formspec_escape + local EEPROM_SIZE = 255 local microc_rules = {} @@ -56,7 +59,7 @@ if nodename ~= "mesecons_microcontroller:microcontroller0000" then end minetest.register_node(nodename, { - description = "Microcontroller", + description = S("Microcontroller"), drawtype = "nodebox", tiles = { top, @@ -89,15 +92,15 @@ minetest.register_node(nodename, { local meta = minetest.get_meta(pos) meta:set_string("code", "") meta:set_string("formspec", "size[9,2.5]".. - "field[0.256,-0.2;9,2;code;Code:;]".. - "button[0 ,0.2;1.5,3;band;AND]".. - "button[1.5,0.2;1.5,3;bxor;XOR]".. - "button[3 ,0.2;1.5,3;bnot;NOT]".. - "button[4.5,0.2;1.5,3;bnand;NAND]".. - "button[6 ,0.2;1.5,3;btflop;T-Flop]".. - "button[7.5,0.2;1.5,3;brsflop;RS-Flop]".. - "button_exit[3.5,1;2,3;program;Program]") - meta:set_string("infotext", "Unprogrammed Microcontroller") + "field[0.256,-0.2;9,2;code;"..F(S("Code:"))..";]".. + "button[0 ,0.2;1.5,3;band;"..F(S("AND")).."]".. + "button[1.5,0.2;1.5,3;bxor;"..F(S("XOR")).."]".. + "button[3 ,0.2;1.5,3;bnot;"..F(S("NOT")).."]".. + "button[4.5,0.2;1.5,3;bnand;"..F(S("NAND")).."]".. + "button[6 ,0.2;1.5,3;btflop;"..F(S("T-Flop")).."]".. + "button[7.5,0.2;1.5,3;brsflop;"..F(S("RS-Flop")).."]".. + "button_exit[3.5,1;2,3;program;"..F(S("Program")).."]") + meta:set_string("infotext", S("Unprogrammed Microcontroller")) local r = "" for i=1, EEPROM_SIZE+1 do r=r.."0" end --Generate a string with EEPROM_SIZE*"0" meta:set_string("eeprom", r) @@ -127,15 +130,15 @@ minetest.register_node(nodename, { meta:set_string("code", fields.code) meta:set_string("formspec", "size[9,2.5]".. - "field[0.256,-0.2;9,2;code;Code:;"..minetest.formspec_escape(fields.code).."]".. - "button[0 ,0.2;1.5,3;band;AND]".. - "button[1.5,0.2;1.5,3;bxor;XOR]".. - "button[3 ,0.2;1.5,3;bnot;NOT]".. - "button[4.5,0.2;1.5,3;bnand;NAND]".. - "button[6 ,0.2;1.5,3;btflop;T-Flop]".. - "button[7.5,0.2;1.5,3;brsflop;RS-Flop]".. - "button_exit[3.5,1;2,3;program;Program]") - meta:set_string("infotext", "Programmed Microcontroller") + "field[0.256,-0.2;9,2;code;"..F(S("Code:"))..";"..minetest.formspec_escape(fields.code).."]".. + "button[0 ,0.2;1.5,3;band;"..F(S("AND")).."]".. + "button[1.5,0.2;1.5,3;bxor;"..F(S("XOR")).."]".. + "button[3 ,0.2;1.5,3;bnot;"..F(S("NOT")).."]".. + "button[4.5,0.2;1.5,3;bnand;"..F(S("NAND")).."]".. + "button[6 ,0.2;1.5,3;btflop;"..F(S("T-Flop")).."]".. + "button[7.5,0.2;1.5,3;brsflop;"..F(S("RS-Flop")).."]".. + "button_exit[3.5,1;2,3;program;"..F(S("Program")).."]") + meta:set_string("infotext", S("Programmed Microcontroller")) yc.reset (pos) yc.update(pos) end, @@ -199,9 +202,9 @@ yc.update = function(pos) code = string.gsub(code, " ", "") --Remove all spaces code = string.gsub(code, " ", "") --Remove all tabs if yc.parsecode(code, pos) == nil then - meta:set_string("infotext", "Code not valid!\n"..code) + meta:set_string("infotext", S("Code not valid!").."\n"..code) else - meta:set_string("infotext", "Working Microcontroller\n"..code) + meta:set_string("infotext", S("Working Microcontroller").."\n"..code) end end @@ -467,12 +470,12 @@ yc.command_after_execute = function(params) local meta = minetest.get_meta(params.pos) if meta:get_int("afterid") == params.afterid then --make sure the node has not been changed if yc.parsecode(params.code, params.pos) == nil then - meta:set_string("infotext", "Code in after() not valid!") + meta:set_string("infotext", S("Code in after() not valid!")) else if code ~= nil then - meta:set_string("infotext", "Working Microcontroller\n"..code) + meta:set_string("infotext", S("Working Microcontroller").."\n"..code) else - meta:set_string("infotext", "Working Microcontroller") + meta:set_string("infotext", S("Working Microcontroller")) end end end diff --git a/mesecons_movestones/init.lua b/mesecons_movestones/init.lua index cd82294..7171dfa 100644 --- a/mesecons_movestones/init.lua +++ b/mesecons_movestones/init.lua @@ -1,3 +1,5 @@ +local S = minetest.get_translator("mesecons_movestone") + -- MOVESTONE -- Non-sticky: -- Moves along mesecon lines @@ -109,7 +111,7 @@ mesecon.register_movestone("mesecons_movestones:movestone", { "jeija_movestone_arrows.png", }, groups = {cracky = 3}, - description = "Movestone", + description = S("Movestone"), sounds = default.node_sound_stone_defaults() }, false, false) @@ -123,7 +125,7 @@ mesecon.register_movestone("mesecons_movestones:sticky_movestone", { "jeija_sticky_movestone.png", }, groups = {cracky = 3}, - description = "Sticky Movestone", + description = S("Sticky Movestone"), sounds = default.node_sound_stone_defaults(), }, true, false) @@ -137,7 +139,7 @@ mesecon.register_movestone("mesecons_movestones:movestone_vertical", { "jeija_movestone_arrows.png^[transformR90", }, groups = {cracky = 3}, - description = "Vertical Movestone", + description = S("Vertical Movestone"), sounds = default.node_sound_stone_defaults() }, false, true) @@ -151,7 +153,7 @@ mesecon.register_movestone("mesecons_movestones:sticky_movestone_vertical", { "jeija_movestone_arrows.png^[transformR90", }, groups = {cracky = 3}, - description = "Vertical Sticky Movestone", + description = S("Vertical Sticky Movestone"), sounds = default.node_sound_stone_defaults(), }, true, true) diff --git a/mesecons_noteblock/init.lua b/mesecons_noteblock/init.lua index 22755ef..caafeff 100644 --- a/mesecons_noteblock/init.lua +++ b/mesecons_noteblock/init.lua @@ -1,5 +1,7 @@ +local S = minetest.get_translator("mesecons_noteblock") + minetest.register_node("mesecons_noteblock:noteblock", { - description = "Noteblock", + description = S("Noteblock"), tiles = {"mesecons_noteblock.png"}, is_ground_content = false, groups = {snappy=2, choppy=2, oddly_breakable_by_hand=2}, diff --git a/mesecons_pistons/init.lua b/mesecons_pistons/init.lua index 56a3f73..3103795 100644 --- a/mesecons_pistons/init.lua +++ b/mesecons_pistons/init.lua @@ -1,3 +1,5 @@ +local S = minetest.get_translator("mesecons_pistons") + local specs = { normal = { offname = "mesecons_pistons:piston_normal_off", @@ -261,7 +263,7 @@ local piston_on_box = { -- Normal (non-sticky) Pistons: -- offstate minetest.register_node("mesecons_pistons:piston_normal_off", { - description = "Piston", + description = S("Piston"), tiles = { "mesecons_piston_top.png", "mesecons_piston_bottom.png", @@ -285,7 +287,7 @@ minetest.register_node("mesecons_pistons:piston_normal_off", { -- onstate minetest.register_node("mesecons_pistons:piston_normal_on", { - description = "Activated Piston Base", + description = S("Activated Piston Base"), drawtype = "nodebox", tiles = { "mesecons_piston_top.png", @@ -314,7 +316,7 @@ minetest.register_node("mesecons_pistons:piston_normal_on", { -- pusher minetest.register_node("mesecons_pistons:piston_pusher_normal", { - description = "Piston Pusher", + description = S("Piston Pusher"), drawtype = "nodebox", tiles = { "mesecons_piston_pusher_top.png", @@ -339,7 +341,7 @@ minetest.register_node("mesecons_pistons:piston_pusher_normal", { -- Sticky ones -- offstate minetest.register_node("mesecons_pistons:piston_sticky_off", { - description = "Sticky Piston", + description = S("Sticky Piston"), tiles = { "mesecons_piston_top.png", "mesecons_piston_bottom.png", @@ -363,7 +365,7 @@ minetest.register_node("mesecons_pistons:piston_sticky_off", { -- onstate minetest.register_node("mesecons_pistons:piston_sticky_on", { - description = "Activated Sticky Piston Base", + description = S("Activated Sticky Piston Base"), drawtype = "nodebox", tiles = { "mesecons_piston_top.png", @@ -392,7 +394,7 @@ minetest.register_node("mesecons_pistons:piston_sticky_on", { -- pusher minetest.register_node("mesecons_pistons:piston_pusher_sticky", { - description = "Sticky Piston Pusher", + description = S("Sticky Piston Pusher"), drawtype = "nodebox", tiles = { "mesecons_piston_pusher_top.png", diff --git a/mesecons_powerplant/init.lua b/mesecons_powerplant/init.lua index 356fb12..5ae1ead 100644 --- a/mesecons_powerplant/init.lua +++ b/mesecons_powerplant/init.lua @@ -1,3 +1,5 @@ +local S = minetest.get_translator("mesecons_powerplant") + -- The POWER_PLANT -- Just emits power. always. @@ -11,7 +13,7 @@ minetest.register_node("mesecons_powerplant:power_plant", { walkable = false, groups = {dig_immediate=3, mesecon = 2}, light_source = minetest.LIGHT_MAX-9, - description="Power Plant", + description=S("Power Plant"), selection_box = { type = "fixed", fixed = {-0.3, -0.5, -0.3, 0.3, -0.5+0.7, 0.3}, diff --git a/mesecons_pressureplates/init.lua b/mesecons_pressureplates/init.lua index 1a503e9..3669bd5 100644 --- a/mesecons_pressureplates/init.lua +++ b/mesecons_pressureplates/init.lua @@ -1,3 +1,5 @@ +local S = minetest.get_translator("mesecons_pressureplates") + local pp_box_off = { type = "fixed", fixed = { -7/16, -8/16, -7/16, 7/16, -7/16, 7/16 }, @@ -89,7 +91,7 @@ end mesecon.register_pressure_plate( "mesecons_pressureplates:pressure_plate_wood", - "Wooden Pressure Plate", + S("Wooden Pressure Plate"), {"jeija_pressure_plate_wood_off.png","jeija_pressure_plate_wood_off.png","jeija_pressure_plate_wood_off_edges.png"}, {"jeija_pressure_plate_wood_on.png","jeija_pressure_plate_wood_on.png","jeija_pressure_plate_wood_on_edges.png"}, "jeija_pressure_plate_wood_wield.png", @@ -100,7 +102,7 @@ mesecon.register_pressure_plate( mesecon.register_pressure_plate( "mesecons_pressureplates:pressure_plate_stone", - "Stone Pressure Plate", + S("Stone Pressure Plate"), {"jeija_pressure_plate_stone_off.png","jeija_pressure_plate_stone_off.png","jeija_pressure_plate_stone_off_edges.png"}, {"jeija_pressure_plate_stone_on.png","jeija_pressure_plate_stone_on.png","jeija_pressure_plate_stone_on_edges.png"}, "jeija_pressure_plate_stone_wield.png", diff --git a/mesecons_random/init.lua b/mesecons_random/init.lua index 0536007..60f1b5a 100644 --- a/mesecons_random/init.lua +++ b/mesecons_random/init.lua @@ -1,3 +1,5 @@ +local S = minetest.get_translator("mesecons_random") + -- REMOVESTONE minetest.register_node("mesecons_random:removestone", { @@ -5,7 +7,7 @@ minetest.register_node("mesecons_random:removestone", { is_ground_content = false, inventory_image = minetest.inventorycube("jeija_removestone_inv.png"), groups = {cracky=3}, - description="Removestone", + description=S("Removestone"), sounds = default.node_sound_stone_defaults(), mesecons = {effector = { action_on = function (pos, node) @@ -29,7 +31,7 @@ minetest.register_craft({ -- GHOSTSTONE minetest.register_node("mesecons_random:ghoststone", { - description="Ghoststone", + description=S("Ghoststone"), tiles = {"jeija_ghoststone.png"}, is_ground_content = false, inventory_image = minetest.inventorycube("jeija_ghoststone_inv.png"), diff --git a/mesecons_solarpanel/init.lua b/mesecons_solarpanel/init.lua index ccc5882..538c12a 100644 --- a/mesecons_solarpanel/init.lua +++ b/mesecons_solarpanel/init.lua @@ -1,3 +1,5 @@ +local S = minetest.get_translator("mesecons_solarpanel") + -- Solar Panel minetest.register_node("mesecons_solarpanel:solar_panel_on", { drawtype = "nodebox", @@ -53,7 +55,7 @@ minetest.register_node("mesecons_solarpanel:solar_panel_off", { wall_side = { -8/16, -7/16, -7/16, -7/16, 7/16, 7/16 }, }, groups = {dig_immediate=3}, - description = "Solar Panel", + description = S("Solar Panel"), sounds = default.node_sound_glass_defaults(), mesecons = {receptor = { state = mesecon.state.off, diff --git a/mesecons_stickyblocks/init.lua b/mesecons_stickyblocks/init.lua index 094af09..6c7a5d2 100644 --- a/mesecons_stickyblocks/init.lua +++ b/mesecons_stickyblocks/init.lua @@ -1,10 +1,12 @@ +local S = minetest.get_translator("mesecons_stickyblocks") + -- Sticky blocks can be used together with pistons or movestones to push / pull -- structures that are "glued" together using sticky blocks -- All sides sticky block minetest.register_node("mesecons_stickyblocks:sticky_block_all", { -- TODO: Rename to “All-Faces Sticky Block” when other sticky blocks become available - description = "Sticky Block", + description = S("Sticky Block"), tiles = {"mesecons_stickyblocks_sticky.png"}, is_ground_content = false, groups = {choppy=3, oddly_breakable_by_hand=2}, diff --git a/mesecons_switch/init.lua b/mesecons_switch/init.lua index 7f42253..e374bb9 100644 --- a/mesecons_switch/init.lua +++ b/mesecons_switch/init.lua @@ -1,8 +1,10 @@ +local S = minetest.get_translator("mesecons_switch") + -- mesecons_switch mesecon.register_node("mesecons_switch:mesecon_switch", { paramtype2="facedir", - description="Switch", + description=S("Switch"), is_ground_content = false, sounds = default.node_sound_stone_defaults(), on_rightclick = function (pos, node) diff --git a/mesecons_torch/init.lua b/mesecons_torch/init.lua index 867c909..4af41c0 100644 --- a/mesecons_torch/init.lua +++ b/mesecons_torch/init.lua @@ -1,3 +1,5 @@ +local S = minetest.get_translator("mesecons_torch") + --MESECON TORCHES local rotate_torch_rules = function (rules, param2) @@ -81,7 +83,7 @@ minetest.register_node("mesecons_torch:mesecon_torch_on", { selection_box = torch_selectionbox, groups = {dig_immediate=3}, light_source = minetest.LIGHT_MAX-5, - description="Mesecon Torch", + description=S("Mesecon Torch"), sounds = default.node_sound_defaults(), mesecons = {receptor = { state = mesecon.state.on, diff --git a/mesecons_walllever/init.lua b/mesecons_walllever/init.lua index 1dc08f0..41d05a9 100644 --- a/mesecons_walllever/init.lua +++ b/mesecons_walllever/init.lua @@ -1,8 +1,10 @@ +local S = minetest.get_translator("mesecons_walllever") + -- WALL LEVER -- Basically a switch that can be attached to a wall -- Powers the block 2 nodes behind (using a receiver) mesecon.register_node("mesecons_walllever:wall_lever", { - description="Lever", + description=S("Lever"), drawtype = "mesh", inventory_image = "jeija_wall_lever_inv.png", wield_image = "jeija_wall_lever_inv.png", diff --git a/mesecons_wires/init.lua b/mesecons_wires/init.lua index 3ca9cbc..b405f34 100644 --- a/mesecons_wires/init.lua +++ b/mesecons_wires/init.lua @@ -1,3 +1,5 @@ +local S = minetest.get_translator("mesecons_wires") + -- naming scheme: wire:(xp)(zp)(xm)(zm)(xpyp)(zpyp)(xmyp)(zmyp)_on/off -- where x= x direction, z= z direction, y= y direction, p = +1, m = -1, e.g. xpym = {x=1, y=-1, z=0} -- The (xp)/(zpyp)/.. statements shall be replaced by either 0 or 1 @@ -202,7 +204,7 @@ local function register_wires() end mesecon.register_node(":mesecons:wire_"..nodeid, { - description = "Mesecon", + description = S("Mesecon"), drawtype = "nodebox", inventory_image = "mesecons_wire_inv.png", wield_image = "mesecons_wire_inv.png",