Use new intllib API.

This commit is contained in:
Diego Martínez
2017-01-24 17:43:20 -03:00
parent bb06cfd6f6
commit 0d3da0c328
24 changed files with 410 additions and 329 deletions

View File

@ -88,7 +88,7 @@ function homedecor.register_furnace(name, furnacedef)
furnacedef.cook_speed = furnacedef.cook_speed or 1
local description = furnacedef.description or "Furnace"
local description = furnacedef.description or S("Furnace")
local furnace_construct = function(pos)
local meta = minetest.get_meta(pos)
@ -106,7 +106,7 @@ function homedecor.register_furnace(name, furnacedef)
if listname == "fuel" then
if minetest.get_craft_result({method="fuel",width=1,items={stack}}).time ~= 0 then
if inv:is_empty("src") then
meta:set_string("infotext", S("%s is empty"):format(description))
meta:set_string("infotext", S("@1 (empty)", description))
end
return stack:get_count()
else
@ -125,7 +125,7 @@ function homedecor.register_furnace(name, furnacedef)
if to_list == "fuel" then
if minetest.get_craft_result({method="fuel",width=1,items={stack}}).time ~= 0 then
if inv:is_empty("src") then
meta:set_string("infotext", S("%s is empty"):format(description))
meta:set_string("infotext", S("@1 (empty)", description))
end
return count
else
@ -151,7 +151,7 @@ function homedecor.register_furnace(name, furnacedef)
}
local def_active = {
description = description .. " (active)",
description = S("@1 (active)", description),
tiles = make_tiles(furnacedef.tiles_active, furnacedef.tile_format, true),
light_source = 8,
drop = "homedecor:" .. name,
@ -231,7 +231,7 @@ function homedecor.register_furnace(name, furnacedef)
if meta:get_float("fuel_time") < meta:get_float("fuel_totaltime") then
local percent = math.floor(meta:get_float("fuel_time") /
meta:get_float("fuel_totaltime") * 100)
meta:set_string("infotext",S("%s active: %d%%"):format(desc,percent))
meta:set_string("infotext", S("@1 (active: @2%)", desc, percent))
swap_node(pos,name_active..locked)
meta:set_string("formspec", make_formspec(furnacedef, percent))
return
@ -251,7 +251,7 @@ function homedecor.register_furnace(name, furnacedef)
end
if (not fuel) or (fuel.time <= 0) then
meta:set_string("infotext",desc..S(": Out of fuel"))
meta:set_string("infotext", S("@1 (out of fuel)", desc))
swap_node(pos, nname..locked)
meta:set_string("formspec", make_formspec(furnacedef, 0))
return
@ -259,7 +259,7 @@ function homedecor.register_furnace(name, furnacedef)
if cooked.item:is_empty() then
if was_active then
meta:set_string("infotext",S("%s is empty"):format(desc))
meta:set_string("infotext", S("@1 (empty)", desc))
swap_node(pos, nname..locked)
meta:set_string("formspec", make_formspec(furnacedef, 0))
end
@ -267,7 +267,7 @@ function homedecor.register_furnace(name, furnacedef)
end
if not inv:room_for_item("dst", cooked.item) then
meta:set_string("infotext", desc..S(": output bins are full"))
meta:set_string("infotext", S("@1 (output bins are full)", desc))
swap_node(pos, nname..locked)
meta:set_string("formspec", make_formspec(furnacedef, 0))
return

View File

@ -84,17 +84,17 @@ function homedecor.handle_inventory(name, def, original_def)
def.can_dig = def.can_dig or default_can_dig
def.on_metadata_inventory_move = def.on_metadata_inventory_move or function(pos, from_list, from_index, to_list, to_index, count, player)
minetest.log("action", S("%s moves stuff in %s at %s"):format(
minetest.log("action", S("@1 moves stuff in @2 at @3",
player:get_player_name(), name, minetest.pos_to_string(pos)
))
end
def.on_metadata_inventory_put = def.on_metadata_inventory_put or function(pos, listname, index, stack, player)
minetest.log("action", S("%s moves %s to %s at %s"):format(
minetest.log("action", S("@1 moves @2 to @3 at @4",
player:get_player_name(), stack:get_name(), name, minetest.pos_to_string(pos)
))
end
def.on_metadata_inventory_take = def.on_metadata_inventory_take or function(pos, listname, index, stack, player)
minetest.log("action", S("%s takes %s from %s at %s"):format(
minetest.log("action", S("@1 takes @2 from @3 at @4",
player:get_player_name(), stack:get_name(), name, minetest.pos_to_string(pos)
))
end
@ -107,7 +107,7 @@ function homedecor.handle_inventory(name, def, original_def)
local owner = placer:get_player_name() or ""
meta:set_string("owner", owner)
meta:set_string("infotext", S("%s (owned by %s)"):format(def.infotext or def.description, owner))
meta:set_string("infotext", S("@1 (owned by @2)", def.infotext or def.description, owner))
return after_place_node and after_place_node(pos, placer)
end
@ -124,7 +124,7 @@ function homedecor.handle_inventory(name, def, original_def)
count
end
minetest.log("action", string.format("%s tried to access a %s belonging to %s at %s",
minetest.log("action", S("@1 tried to access a @2 belonging to @3 at @4",
playername, name, owner, minetest.pos_to_string(pos)
))
return 0
@ -142,7 +142,7 @@ function homedecor.handle_inventory(name, def, original_def)
stack:get_count()
end
minetest.log("action", string.format("%s tried to access a %s belonging to %s at %s",
minetest.log("action", S("@1 tried to access a @2 belonging to @3 at @4",
playername, name, owner, minetest.pos_to_string(pos)
))
return 0
@ -160,7 +160,7 @@ function homedecor.handle_inventory(name, def, original_def)
stack:get_count()
end
minetest.log("action", string.format("%s tried to access a %s belonging to %s at %s",
minetest.log("action", S("@1 tried to access a @2 belonging to @3 at @4",
playername, name, owner, minetest.pos_to_string(pos)
))
return 0
@ -170,7 +170,7 @@ function homedecor.handle_inventory(name, def, original_def)
local lockable = inventory.lockable
if lockable then
local locked_def = table.copy(original_def)
locked_def.description = S("Locked %s"):format(def.description or name)
locked_def.description = S("@1 (Locked)", def.description or name)
local locked_inventory = locked_def.inventory
locked_inventory.locked = true