Added intllib support (german translation by Xanthin)

This commit is contained in:
TenPlus1 2017-02-01 20:35:04 +00:00
parent 2e3ef7cf7e
commit 803f5ee4b2
5 changed files with 56 additions and 24 deletions

@ -16,7 +16,8 @@ Change log:
- 0.8 - Added Napiophelios' new textures and tweaked code - 0.8 - Added Napiophelios' new textures and tweaked code
- 0.9 - Added support for Wine mod's wine barrels - 0.9 - Added support for Wine mod's wine barrels
- 1.0 - New furances do not work properly with hoppers so old reverted to abm furnaces - 1.0 - New furances do not work properly with hoppers so old reverted to abm furnaces
- 1.1 - Hoppers now work with new node timer Furnaces. Reduced Abm's and tidied code. - 1.1 - Hoppers now work with new node timer Furnaces. Reduced Abm's and tidied code
- 1.2 - Added simple API so that hoppers can work with other containers. - 1.2 - Added simple API so that hoppers can work with other containers
- 1.3 - Tweaked code to use a single abm and added intllib support
Lucky Blocks: 2 Lucky Blocks: 2

@ -1,2 +1,3 @@
default default
lucky_block? intllib?
lucky_block?

@ -3,6 +3,21 @@
hopper = {} hopper = {}
-- Intllib
local S
if minetest.get_modpath("intllib") then
S = intllib.Getter()
else
S = function(s, a, ...) a = {a, ...}
return s:gsub("@(%d+)", function(n)
return a[tonumber(n)]
end)
end
end
-- default containers -- default containers
local containers = { local containers = {
@ -79,7 +94,7 @@ end
-- hopper -- hopper
minetest.register_node("hopper:hopper", { minetest.register_node("hopper:hopper", {
description = "Hopper (Place onto side of container for side-hopper)", description = S("Hopper (Place onto sides for side-hopper)"),
groups = {cracky = 3}, groups = {cracky = 3},
drawtype = "nodebox", drawtype = "nodebox",
paramtype = "light", paramtype = "light",
@ -157,23 +172,20 @@ minetest.register_node("hopper:hopper", {
on_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player) on_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player)
minetest.log("action", player:get_player_name() minetest.log("action", S("@1 moves stuff in hopper at @2",
.." moves stuff in hopper at " player:get_player_name(), minetest.pos_to_string(pos)))
..minetest.pos_to_string(pos))
end, end,
on_metadata_inventory_put = function(pos, listname, index, stack, player) on_metadata_inventory_put = function(pos, listname, index, stack, player)
minetest.log("action", player:get_player_name() minetest.log("action", S("@1 moves stuff to hopper at @2",
.." moves stuff to hopper at " player:get_player_name(), minetest.pos_to_string(pos)))
..minetest.pos_to_string(pos))
end, end,
on_metadata_inventory_take = function(pos, listname, index, stack, player) on_metadata_inventory_take = function(pos, listname, index, stack, player)
minetest.log("action", player:get_player_name() minetest.log("action", S("@1 moves stuff from hopper at @2",
.." takes stuff from hopper at " player:get_player_name(), minetest.pos_to_string(pos)))
..minetest.pos_to_string(pos))
end, end,
on_rotate = screwdriver.disallow, on_rotate = screwdriver.disallow,
@ -182,7 +194,7 @@ minetest.register_node("hopper:hopper", {
-- side hopper -- side hopper
minetest.register_node("hopper:hopper_side", { minetest.register_node("hopper:hopper_side", {
description = "Side Hopper (Place into crafting to return normal Hopper)", description = S("Side Hopper (Place into crafting to return normal Hopper)"),
groups = {cracky = 3, not_in_creative_inventory = 1}, groups = {cracky = 3, not_in_creative_inventory = 1},
drawtype = "nodebox", drawtype = "nodebox",
paramtype = "light", paramtype = "light",
@ -236,23 +248,20 @@ minetest.register_node("hopper:hopper_side", {
on_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player) on_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player)
minetest.log("action", player:get_player_name() minetest.log("action", S("@1 moves stuff in hopper at @2",
.." moves stuff in hopper at " player:get_player_name(), minetest.pos_to_string(pos)))
..minetest.pos_to_string(pos))
end, end,
on_metadata_inventory_put = function(pos, listname, index, stack, player) on_metadata_inventory_put = function(pos, listname, index, stack, player)
minetest.log("action", player:get_player_name() minetest.log("action", S("@1 moves stuff to hopper at @2",
.." moves stuff to hopper at " player:get_player_name(), minetest.pos_to_string(pos)))
..minetest.pos_to_string(pos))
end, end,
on_metadata_inventory_take = function(pos, listname, index, stack, player) on_metadata_inventory_take = function(pos, listname, index, stack, player)
minetest.log("action", player:get_player_name() minetest.log("action", S("@1 moves stuff from hopper at @2",
.." takes stuff from hopper at " player:get_player_name(), minetest.pos_to_string(pos)))
..minetest.pos_to_string(pos))
end, end,
on_rotate = screwdriver.rotate_simple, on_rotate = screwdriver.rotate_simple,
@ -437,4 +446,4 @@ if minetest.get_modpath("lucky_block") then
end end
print ("[MOD] Hopper loaded") print (S("[MOD] Hopper loaded"))

11
locale/de.txt Normal file

@ -0,0 +1,11 @@
# Template for translations of hopper mod
# German translation by Xanthin
# last update: 1st February 2017
#init.lua
[MOD] Hopper loaded = [MOD] Trichter geladen
Hopper (Place onto sides for side-hopper) = Trichter (für Seitentrichter an den Seiten platzieren)
Side Hopper (Place into crafting to return normal Hopper) = Seitentrichter (in Fertigungsraster legen, um normalen Trichter zu erhalten)
@1 moves stuff in hopper at @2 = @1 bewegt Dinge in einem Trichter bei @2
@1 moves stuff to hopper at @2 = @1 verlagert Dinge in einen Trichter bei @2
@1 moves stuff from hopper at @2 = @1 nimmt Dinge aus einem Trichter bei @2

10
locale/template.txt Normal file

@ -0,0 +1,10 @@
# Template for translations of hopper mod
# last update: 1st February 2017
#init.lua
[MOD] Hopper loaded =
Hopper (Place onto sides for side-hopper) =
Side Hopper (Place into crafting to return normal Hopper) =
@1 moves stuff in hopper at @2
@1 moves stuff to hopper at @2
@1 moves stuff from hopper at @2