From 62bc13078f4e93993ebf121cc9c74bc31a6e5d90 Mon Sep 17 00:00:00 2001 From: Louis Royer <4259825-lroyer@users.noreply.gitlab.com> Date: Tue, 18 Feb 2020 17:34:52 +0000 Subject: Add translation support - Created `locale/template.txt` - Fixed some typos - Replace some `print("[pipeworks]"..` with `pipeworks.logger()` - Removed "You hacker, you" from descriptions --- filter-injector.lua | 39 ++++++++++++++++++++------------------- 1 file changed, 20 insertions(+), 19 deletions(-) (limited to 'filter-injector.lua') diff --git a/filter-injector.lua b/filter-injector.lua index 779b69a..5335dad 100644 --- a/filter-injector.lua +++ b/filter-injector.lua @@ -1,3 +1,4 @@ +local S = minetest.get_translator("pipeworks") local fs_helpers = pipeworks.fs_helpers local function delay(x) @@ -5,47 +6,47 @@ local function delay(x) end local function set_filter_infotext(data, meta) - local infotext = data.wise_desc.." Filter-Injector" + local infotext = S("@1 Filter-Injector", data.wise_desc) if meta:get_int("slotseq_mode") == 2 then - infotext = infotext .. " (slot #"..meta:get_int("slotseq_index").." next)" + infotext = infotext .. " "..S("(slot #@1 next)", meta:get_int("slotseq_index")) end meta:set_string("infotext", infotext) end local function set_filter_formspec(data, meta) - local itemname = data.wise_desc.." Filter-Injector" + local itemname = S("@1 Filter-Injector", data.wise_desc) local formspec if data.digiline then formspec = "size[8,2.7]".. "item_image[0,0;1,1;pipeworks:"..data.name.."]".. "label[1,0;"..minetest.formspec_escape(itemname).."]".. - "field[0.3,1.5;8.0,1;channel;Channel;${channel}]".. + "field[0.3,1.5;8.0,1;channel;"..S("Channel")..";${channel}]".. fs_helpers.cycling_button(meta, "button[0,2;4,1", "slotseq_mode", - {"Sequence slots by Priority", - "Sequence slots Randomly", - "Sequence slots by Rotation"}).. + {S("Sequence slots by Priority"), + S("Sequence slots Randomly"), + S("Sequence slots by Rotation")}).. fs_helpers.cycling_button(meta, "button[4,2;4,1", "exmatch_mode", - {"Exact match - off", - "Exact match - on "}) + {S("Exact match - off"), + S("Exact match - on")}) else local exmatch_button = "" if data.stackwise then exmatch_button = fs_helpers.cycling_button(meta, "button[4,3.5;4,1", "exmatch_mode", - {"Exact match - off", - "Exact match - on "}) + {S("Exact match - off"), + S("Exact match - on")}) end formspec = "size[8,8.5]".. "item_image[0,0;1,1;pipeworks:"..data.name.."]".. "label[1,0;"..minetest.formspec_escape(itemname).."]".. - "label[0,1;Prefer item types:]".. + "label[0,1;"..S("Prefer item types:").."]".. "list[context;main;0,1.5;8,2;]".. fs_helpers.cycling_button(meta, "button[0,3.5;4,1", "slotseq_mode", - {"Sequence slots by Priority", - "Sequence slots Randomly", - "Sequence slots by Rotation"}).. + {S("Sequence slots by Priority"), + S("Sequence slots Randomly"), + S("Sequence slots by Rotation")}).. exmatch_button.. "list[current_player;main;0,4.5;8,4;]" .. "listring[]" @@ -348,23 +349,23 @@ end for _, data in ipairs({ { name = "filter", - wise_desc = "Itemwise", + wise_desc = S("Itemwise"), stackwise = false, }, { name = "mese_filter", - wise_desc = "Stackwise", + wise_desc = S("Stackwise"), stackwise = true, }, { -- register even if no digilines name = "digiline_filter", - wise_desc = "Digiline", + wise_desc = S("Digiline"), stackwise = true, digiline = true, }, }) do local node = { - description = data.wise_desc.." Filter-Injector", + description = S("@1 Filter-Injector", data.wise_desc), tiles = { "pipeworks_"..data.name.."_top.png", "pipeworks_"..data.name.."_top.png", -- cgit v1.2.3