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_chests?
technic_worldgen?
intllib?

View File

@ -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

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
# Deutsche Übersetzung von technic_wrench
# by Xanthin
Wrench = Schraubenschluessel
%s with items = %s mit Gegenstaenden
Wrench=Schraubenschluessel
@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
# Polskie tłumaczenie technic_wrench
# by mat9117
Wrench = Klucz
%s with items = %s z rzeczami
Wrench=Klucz
@1 with items=@1 z rzeczami

View File

@ -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

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
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
depends = default
optional_depends = technic, technic_chests, technic_worldgen, intllib
optional_depends = technic, technic_chests, technic_worldgen