Use MT-5 translation system for wrench mod

This commit is contained in:
Louis 2020-02-09 01:52:41 +01:00
parent 8cb555199e
commit 2d61270748
13 changed files with 54 additions and 38 deletions

View File

@ -2,5 +2,3 @@ default
technic? technic?
technic_chests? technic_chests?
technic_worldgen? technic_worldgen?
intllib?

View File

@ -19,8 +19,8 @@ local modpath = minetest.get_modpath(minetest.get_current_modname())
dofile(modpath.."/support.lua") dofile(modpath.."/support.lua")
dofile(modpath.."/technic.lua") dofile(modpath.."/technic.lua")
-- Boilerplate to support localized strings if intllib mod is installed. -- Translation support
local S = rawget(_G, "intllib") and intllib.Getter() or function(s) return s end local S = minetest.get_translator("technic_wrench")
local function get_meta_type(name, metaname) local function get_meta_type(name, metaname)
local def = wrench.registered_nodes[name] local def = wrench.registered_nodes[name]
@ -37,14 +37,13 @@ local function restore(pos, placer, itemstack)
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
local inv = meta:get_inventory() local inv = meta:get_inventory()
local data = itemstack:get_meta():get_string("data") 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) data = minetest.deserialize(data)
if not data then if not data then
minetest.remove_node(pos) minetest.remove_node(pos)
minetest.log("error", placer:get_player_name().." wanted to place ".. minetest.log("error", S("@1 wanted to place @2 at @3, but it had no data.", placer:get_player_name(),
name.." at "..minetest.pos_to_string(pos).. name, minetest.pos_to_string(pos)))
", but it had no data.") minetest.log("verbose", S("itemstack: @1", itemstack:to_string()))
minetest.log("verbose", "itemstack: "..itemstack:to_string())
return true return true
end end
minetest.set_node(pos, {name = data.name, param2 = node.param2}) 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 newdef[key] = value
end end
newdef.stack_max = 1 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 = {}
newdef.groups.not_in_creative_inventory = 1 newdef.groups.not_in_creative_inventory = 1
newdef.on_construct = nil 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 if def.owned and not minetest.check_player_privs(placer, "protection_bypass") then
local owner = meta:get_string("owner") local owner = meta:get_string("owner")
if owner and owner ~= player_name then if owner and owner ~= player_name then
minetest.log("action", player_name.. minetest.log("action", S("@1 tried to pick up an owned node belonging to @2 at @3",
" tried to pick up an owned node belonging to ".. player_name, owner,
owner.." at ".. minetest.pos_to_string(pos)))
minetest.pos_to_string(pos))
return return
end end
end end

View File

@ -1,5 +0,0 @@
# technic_wrench traducido por Carlos Barraza
Wrench = Llave Inglesa
%s with items = %s con elementos

View File

@ -1,5 +0,0 @@
# technic_wrench translation template
Wrench = Clé
%s with items = %s avec des objets

View File

@ -1,7 +1,8 @@
# textdomain: technic_wrench
# German Translation for technic_wrench # German Translation for technic_wrench
# Deutsche Übersetzung von technic_wrench # Deutsche Übersetzung von technic_wrench
# by Xanthin # by Xanthin
Wrench = Schraubenschluessel Wrench=Schraubenschluessel
%s with items = %s mit Gegenstaenden @1 with items=@1 mit Gegenstaenden

View File

@ -0,0 +1,7 @@
# textdomain: technic_wrench
# technic_wrench traducido por Carlos Barraza
Wrench=Llave Inglesa
@1 with items=@1 con elementos

View File

@ -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 ny avait pas de données.
itemstack: @1=pile darticles : @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

View File

@ -1,7 +1,9 @@
# textdomain: technic_wrench
# Polish Translation for technic_wrench # Polish Translation for technic_wrench
# Polskie tłumaczenie technic_wrench # Polskie tłumaczenie technic_wrench
# by mat9117 # by mat9117
Wrench = Klucz Wrench=Klucz
%s with items = %s z rzeczami @1 with items=@1 z rzeczami

View File

@ -1,7 +1,9 @@
# textdomain: technic_wrench
# Braziliam portuguese translation for wrench # Braziliam portuguese translation for wrench
# Tradução portuguesa brasileira para wrench # Tradução portuguesa brasileira para wrench
# By Sires # By Sires
Wrench = Chave Inglesa Wrench=Chave Inglesa
%s with items = %s com items @1 with items=@1 com items

View File

@ -0,0 +1,7 @@
# textdomain: technic_wrench
# Turkish translation by mahmutelmas06
# mahmutelmas06@hotmail.com
Wrench=İngiliz anahtarı
@1 with items=Araçlarla birlikte @1

View File

@ -1,5 +1,10 @@
# textdomain: technic_wrench
# technic_wrench translation template # technic_wrench translation template
Wrench = 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

View File

@ -1,5 +0,0 @@
# Turkish translation by mahmutelmas06
# mahmutelmas06@hotmail.com
Wrench = İngiliz anahtarı
%s with items = Araçlarla birlikte %s

View File

@ -1,3 +1,3 @@
name = wrench name = wrench
depends = default depends = default
optional_depends = technic, technic_chests, technic_worldgen, intllib optional_depends = technic, technic_chests, technic_worldgen