From 2d61270748cf1be56c6c09c8c7850633c1c10c61 Mon Sep 17 00:00:00 2001 From: Louis <55180044+louisroyer@users.noreply.github.com> Date: Sun, 9 Feb 2020 01:52:41 +0100 Subject: [PATCH] Use MT-5 translation system for wrench mod --- wrench/depends.txt | 2 -- wrench/init.lua | 22 +++++++++---------- wrench/locale/es.txt | 5 ----- wrench/locale/fr.txt | 5 ----- .../locale/{de.txt => technic_wrench.de.tr} | 7 +++--- wrench/locale/technic_wrench.es.tr | 7 ++++++ wrench/locale/technic_wrench.fr.tr | 11 ++++++++++ .../locale/{pl.txt => technic_wrench.pl.tr} | 6 +++-- .../{pt_BR.txt => technic_wrench.pt_BR.tr} | 6 +++-- wrench/locale/technic_wrench.tr.tr | 7 ++++++ wrench/locale/template.txt | 7 +++++- wrench/locale/tr.txt | 5 ----- wrench/mod.conf | 2 +- 13 files changed, 54 insertions(+), 38 deletions(-) delete mode 100644 wrench/locale/es.txt delete mode 100644 wrench/locale/fr.txt rename wrench/locale/{de.txt => technic_wrench.de.tr} (51%) create mode 100644 wrench/locale/technic_wrench.es.tr create mode 100644 wrench/locale/technic_wrench.fr.tr rename wrench/locale/{pl.txt => technic_wrench.pl.tr} (56%) rename wrench/locale/{pt_BR.txt => technic_wrench.pt_BR.tr} (57%) create mode 100644 wrench/locale/technic_wrench.tr.tr delete mode 100644 wrench/locale/tr.txt diff --git a/wrench/depends.txt b/wrench/depends.txt index a681af3..77bc22b 100644 --- a/wrench/depends.txt +++ b/wrench/depends.txt @@ -2,5 +2,3 @@ default technic? technic_chests? technic_worldgen? -intllib? - diff --git a/wrench/init.lua b/wrench/init.lua index adb80c9..608fc59 100644 --- a/wrench/init.lua +++ b/wrench/init.lua @@ -19,8 +19,8 @@ local modpath = minetest.get_modpath(minetest.get_current_modname()) dofile(modpath.."/support.lua") dofile(modpath.."/technic.lua") --- Boilerplate to support localized strings if intllib mod is installed. -local S = rawget(_G, "intllib") and intllib.Getter() or function(s) return s end +-- Translation support +local S = minetest.get_translator("technic_wrench") local function get_meta_type(name, metaname) local def = wrench.registered_nodes[name] @@ -37,14 +37,13 @@ local function restore(pos, placer, itemstack) local meta = minetest.get_meta(pos) local inv = meta:get_inventory() local data = itemstack:get_meta():get_string("data") - data = (data ~= "" and data) or itemstack:get_metadata() + data = (data ~= "" and data) or itemstack:get_metadata() data = minetest.deserialize(data) if not data then minetest.remove_node(pos) - minetest.log("error", placer:get_player_name().." wanted to place ".. - name.." at "..minetest.pos_to_string(pos).. - ", but it had no data.") - minetest.log("verbose", "itemstack: "..itemstack:to_string()) + minetest.log("error", S("@1 wanted to place @2 at @3, but it had no data.", placer:get_player_name(), + name, minetest.pos_to_string(pos))) + minetest.log("verbose", S("itemstack: @1", itemstack:to_string())) return true end minetest.set_node(pos, {name = data.name, param2 = node.param2}) @@ -74,7 +73,7 @@ for name, info in pairs(wrench.registered_nodes) do newdef[key] = value end newdef.stack_max = 1 - newdef.description = S("%s with items"):format(newdef.description) + newdef.description = S("@1 with items", newdef.description) newdef.groups = {} newdef.groups.not_in_creative_inventory = 1 newdef.on_construct = nil @@ -123,10 +122,9 @@ minetest.register_tool("wrench:wrench", { if def.owned and not minetest.check_player_privs(placer, "protection_bypass") then local owner = meta:get_string("owner") if owner and owner ~= player_name then - minetest.log("action", player_name.. - " tried to pick up an owned node belonging to ".. - owner.." at ".. - minetest.pos_to_string(pos)) + minetest.log("action", S("@1 tried to pick up an owned node belonging to @2 at @3", + player_name, owner, + minetest.pos_to_string(pos))) return end end diff --git a/wrench/locale/es.txt b/wrench/locale/es.txt deleted file mode 100644 index 1d79a96..0000000 --- a/wrench/locale/es.txt +++ /dev/null @@ -1,5 +0,0 @@ -# technic_wrench traducido por Carlos Barraza - -Wrench = Llave Inglesa -%s with items = %s con elementos - diff --git a/wrench/locale/fr.txt b/wrench/locale/fr.txt deleted file mode 100644 index a66b6e3..0000000 --- a/wrench/locale/fr.txt +++ /dev/null @@ -1,5 +0,0 @@ -# technic_wrench translation template - -Wrench = Clé -%s with items = %s avec des objets - diff --git a/wrench/locale/de.txt b/wrench/locale/technic_wrench.de.tr similarity index 51% rename from wrench/locale/de.txt rename to wrench/locale/technic_wrench.de.tr index b285cd3..07ee612 100644 --- a/wrench/locale/de.txt +++ b/wrench/locale/technic_wrench.de.tr @@ -1,7 +1,8 @@ +# textdomain: technic_wrench + # German Translation for technic_wrench # Deutsche Übersetzung von technic_wrench # by Xanthin -Wrench = Schraubenschluessel -%s with items = %s mit Gegenstaenden - +Wrench=Schraubenschluessel +@1 with items=@1 mit Gegenstaenden diff --git a/wrench/locale/technic_wrench.es.tr b/wrench/locale/technic_wrench.es.tr new file mode 100644 index 0000000..d548862 --- /dev/null +++ b/wrench/locale/technic_wrench.es.tr @@ -0,0 +1,7 @@ +# textdomain: technic_wrench + +# technic_wrench traducido por Carlos Barraza + +Wrench=Llave Inglesa +@1 with items=@1 con elementos + diff --git a/wrench/locale/technic_wrench.fr.tr b/wrench/locale/technic_wrench.fr.tr new file mode 100644 index 0000000..adf4f93 --- /dev/null +++ b/wrench/locale/technic_wrench.fr.tr @@ -0,0 +1,11 @@ +# textdomain: technic_wrench + +# technic_wrench translation template + +Wrench=Clé +@1 with items=@1 avec des objets + +@1 wanted to place @2 at @3, but it had no data.=@1 a voulu placer @2 à la positon @3, mais il n’y avait pas de données. +itemstack: @1=pile d’articles : @1 +@1 tried to pick up an owned node belonging to @2 at @3=@1 a essayé de prendre un bloc protégé appartenant à @2 à la position @3 + diff --git a/wrench/locale/pl.txt b/wrench/locale/technic_wrench.pl.tr similarity index 56% rename from wrench/locale/pl.txt rename to wrench/locale/technic_wrench.pl.tr index 272eaa0..fc6dab0 100644 --- a/wrench/locale/pl.txt +++ b/wrench/locale/technic_wrench.pl.tr @@ -1,7 +1,9 @@ +# textdomain: technic_wrench + # Polish Translation for technic_wrench # Polskie tłumaczenie technic_wrench # by mat9117 -Wrench = Klucz -%s with items = %s z rzeczami +Wrench=Klucz +@1 with items=@1 z rzeczami diff --git a/wrench/locale/pt_BR.txt b/wrench/locale/technic_wrench.pt_BR.tr similarity index 57% rename from wrench/locale/pt_BR.txt rename to wrench/locale/technic_wrench.pt_BR.tr index 670c3eb..d5f20c0 100644 --- a/wrench/locale/pt_BR.txt +++ b/wrench/locale/technic_wrench.pt_BR.tr @@ -1,7 +1,9 @@ +# textdomain: technic_wrench + # Braziliam portuguese translation for wrench # Tradução portuguesa brasileira para wrench # By Sires -Wrench = Chave Inglesa -%s with items = %s com items +Wrench=Chave Inglesa +@1 with items=@1 com items diff --git a/wrench/locale/technic_wrench.tr.tr b/wrench/locale/technic_wrench.tr.tr new file mode 100644 index 0000000..9a2b694 --- /dev/null +++ b/wrench/locale/technic_wrench.tr.tr @@ -0,0 +1,7 @@ +# textdomain: technic_wrench + +# Turkish translation by mahmutelmas06 +# mahmutelmas06@hotmail.com + +Wrench=İngiliz anahtarı +@1 with items=Araçlarla birlikte @1 diff --git a/wrench/locale/template.txt b/wrench/locale/template.txt index eff2da2..b6b50d8 100644 --- a/wrench/locale/template.txt +++ b/wrench/locale/template.txt @@ -1,5 +1,10 @@ +# textdomain: technic_wrench + # technic_wrench translation template Wrench = -%s with items = +@1 with items = +@1 wanted to place @2 at @3, but it had no data.= +itemstack: @1= +@1 tried to pick up an owned node belonging to @2 at @3 diff --git a/wrench/locale/tr.txt b/wrench/locale/tr.txt deleted file mode 100644 index 2050bce..0000000 --- a/wrench/locale/tr.txt +++ /dev/null @@ -1,5 +0,0 @@ -# Turkish translation by mahmutelmas06 -# mahmutelmas06@hotmail.com - -Wrench = İngiliz anahtarı -%s with items = Araçlarla birlikte %s diff --git a/wrench/mod.conf b/wrench/mod.conf index a18b4f7..e664750 100644 --- a/wrench/mod.conf +++ b/wrench/mod.conf @@ -1,3 +1,3 @@ name = wrench depends = default -optional_depends = technic, technic_chests, technic_worldgen, intllib +optional_depends = technic, technic_chests, technic_worldgen