From 6133234771c960f224d78213c0f387a394f1e0ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20Mart=C3=ADnez?= Date: Tue, 5 Mar 2013 05:18:56 -0200 Subject: [PATCH] Added localization support --- crafts.lua | 31 +++++--- door_models.lua | 26 +++++-- door_nodes.lua | 19 +++-- fences.lua | 47 +++++++----- init.lua | 99 +++++++++++++----------- kitchen_cabinet.lua | 75 ++++++++++++------ lighting.lua | 33 +++++--- locale/es.txt | 178 +++++++++++++++++++++++++++++++++++++++++++ locale/template.txt | 182 ++++++++++++++++++++++++++++++++++++++++++++ locked.lua | 76 +++++++++++------- nightstands.lua | 97 +++++++++++++++-------- oven.lua | 23 ++++-- refrigerator.lua | 116 +++++++++++++++------------- signs_lib.lua | 13 +++- television.lua | 11 ++- 15 files changed, 781 insertions(+), 245 deletions(-) create mode 100644 locale/es.txt create mode 100644 locale/template.txt diff --git a/crafts.lua b/crafts.lua index 724988c..282a058 100644 --- a/crafts.lua +++ b/crafts.lua @@ -6,6 +6,15 @@ -- License: GPL -- +-- Boilerplate to support localized strings if intllib mod is installed. +local S +if (minetest.get_modpath("intllib")) then + dofile(minetest.get_modpath("intllib").."/intllib.lua") + S = intllib.Getter(minetest.get_current_modname()) +else + S = function ( s ) return s end +end + -- Some recipes need white paint. If Unified Dyes isn't present, -- implement the standard white paint production method here instead, -- plus some alternate recipes in the event of material shorages. @@ -13,7 +22,7 @@ if ( minetest.get_modpath("unifieddyes") ) == nil then minetest.register_craftitem(":unifieddyes:titanium_dioxide", { - description = "Titanium Dioxide", + description = S("Titanium Dioxide"), inventory_image = "homedecor_titanium_dioxide.png", }) @@ -24,7 +33,7 @@ if ( minetest.get_modpath("unifieddyes") ) == nil then }) minetest.register_craftitem(":unifieddyes:white_paint", { - description = "Bucket of white paint", + description = S("Bucket of white paint"), inventory_image = "homedecor_white_paint.png", }) @@ -66,7 +75,7 @@ end -- misc stuff :D minetest.register_craftitem("homedecor:terracotta_base", { - description = "Uncooked Terracotta Base", + description = S("Uncooked Terracotta Base"), inventory_image = "homedecor_terracotta_base.png", }) @@ -82,7 +91,7 @@ minetest.register_craft( { }) minetest.register_craftitem("homedecor:roof_tile_terracotta", { - description = "Terracotta Roof Tile", + description = S("Terracotta Roof Tile"), inventory_image = "homedecor_roof_tile_terracotta.png", }) @@ -111,12 +120,12 @@ minetest.register_craft( { -- minetest.register_craftitem("homedecor:plastic_sheeting", { - description = "Plastic sheet", + description = S("Plastic sheet"), inventory_image = "homedecor_plastic_sheeting.png", }) minetest.register_craftitem("homedecor:plastic_base", { - description = "Unprocessed Plastic base", + description = S("Unprocessed Plastic base"), wield_image = "homedecor_plastic_base.png", inventory_image = "homedecor_plastic_base_inv.png", }) @@ -680,7 +689,7 @@ minetest.register_craft({ -- minetest.register_craftitem("homedecor:drawer_small", { - description = "Small Wooden Drawer", + description = S("Small Wooden Drawer"), inventory_image = "homedecor_drawer_small.png", }) @@ -792,7 +801,7 @@ minetest.register_craft({ }) minetest.register_craftitem("homedecor:brass_ingot", { - description = "Brass Ingot", + description = S("Brass Ingot"), inventory_image = "homedecor_brass_ingot.png", }) @@ -826,7 +835,7 @@ minetest.register_craft( { }) minetest.register_craftitem("homedecor:utility_table_legs", { - description = "Legs for Small Utility table", + description = S("Legs for Small Utility table"), inventory_image = "homedecor_utility_table_legs.png", }) @@ -870,7 +879,7 @@ minetest.register_craft( { if ( minetest.get_modpath("mesecons") ) == nil then minetest.register_craftitem(":mesecons_materials:silicon", { - description = "Silicon lump", + description = S("Silicon lump"), inventory_image = "homedecor_silicon.png", }) @@ -893,7 +902,7 @@ minetest.register_craft( { }) minetest.register_craftitem("homedecor:ic", { - description = "Simple Integrated Circuit", + description = S("Simple Integrated Circuit"), inventory_image = "homedecor_ic.png", }) diff --git a/door_models.lua b/door_models.lua index 13d98bb..15c9bc4 100644 --- a/door_models.lua +++ b/door_models.lua @@ -1,7 +1,17 @@ + +-- Boilerplate to support localized strings if intllib mod is installed. +local S +if (minetest.get_modpath("intllib")) then + dofile(minetest.get_modpath("intllib").."/intllib.lua") + S = intllib.Getter(minetest.get_current_modname()) +else + S = function ( s ) return s end +end + homedecor_door_models = { { "closet_mahogany", - "Mahogany Closet Door", + S("Mahogany Closet Door"), {{ -8/16, 5/16, 6/16, 8/16, 8/16, 8/16 }, { -8/16, 8/32, 13/32, 8/16, 9/32, 15/32 }, @@ -72,7 +82,7 @@ homedecor_door_models = { { "closet_oak", - "Oak Closet Door", + S("Oak Closet Door"), {{ -8/16, 5/16, 6/16, 8/16, 8/16, 8/16 }, { -8/16, 8/32, 13/32, 8/16, 9/32, 15/32 }, @@ -143,7 +153,7 @@ homedecor_door_models = { { "exterior_fancy", - "Fancy Wood/Glass Door", + S("Fancy Wood/Glass Door"), {{ -8/16, 6/16, 6/16, 8/16, 8/16, 8/16 }, { -8/16, -8/16, 6/16, -6/16, 8/16, 8/16 }, @@ -170,7 +180,7 @@ homedecor_door_models = { { "glass", - "Glass Office Door", + S("Glass Office Door"), {{ -8/16, -8/16, 6/16, 8/16, 8/16, 8/16 }}, @@ -185,7 +195,7 @@ homedecor_door_models = { { "wood_glass", - "Glass and Wood, Oak-colored", + S("Glass and Wood, Oak-colored"), {{ -8/16, 6/16, 6/16, 8/16, 8/16, 8/16 }, { -8/16, -3/32, 6/16, 8/16, 1/32, 8/16 }, @@ -224,7 +234,7 @@ homedecor_door_models = { { "wood_glass_mahogany", - "Glass and Wood, Mahogany-colored", + S("Glass and Wood, Mahogany-colored"), {{ -8/16, 6/16, 6/16, 8/16, 8/16, 8/16 }, { -8/16, -3/32, 6/16, 8/16, 1/32, 8/16 }, @@ -263,7 +273,7 @@ homedecor_door_models = { { "wood_glass_white", - "Glass and Wood, White", + S("Glass and Wood, White"), {{ -8/16, 6/16, 6/16, 8/16, 8/16, 8/16 }, { -8/16, -3/32, 6/16, 8/16, 1/32, 8/16 }, @@ -302,7 +312,7 @@ homedecor_door_models = { { "wood_plain", - "Plain Wooden Door", + S("Plain Wooden Door"), {{ -8/16, -8/16, 6/16, 8/16, 8/16, 8/16 }}, diff --git a/door_nodes.lua b/door_nodes.lua index 32b30eb..3ea264b 100644 --- a/door_nodes.lua +++ b/door_nodes.lua @@ -1,5 +1,14 @@ -- Node definitions for Homedecor doors +-- Boilerplate to support localized strings if intllib mod is installed. +local S +if (minetest.get_modpath("intllib")) then + dofile(minetest.get_modpath("intllib").."/intllib.lua") + S = intllib.Getter(minetest.get_current_modname()) +else + S = function ( s ) return s end +end + local sides = {"left", "right"} local rsides = {"right", "left"} @@ -58,7 +67,7 @@ for i in ipairs(sides) do if use_rightclick == nil then -- register the version that uses on_punch minetest.register_node("homedecor:door_"..doorname.."_top_"..side, { - description = doordesc.." (Top Half, "..side.."-opening)", + description = doordesc.." "..S("(Top Half, %s-opening)"):format(side), drawtype = "nodebox", tiles = tiles_top, paramtype = "light", @@ -83,7 +92,7 @@ for i in ipairs(sides) do }) minetest.register_node("homedecor:door_"..doorname.."_bottom_"..side, { - description = doordesc.." ("..side.."-opening)", + description = doordesc.." "..S("(%s-opening)"):format(side), drawtype = "nodebox", tiles = tiles_bottom, inventory_image = "homedecor_door_"..doorname.."_"..side.."_inv.png", @@ -113,7 +122,7 @@ for i in ipairs(sides) do else -- register the version that uses on_rightclick minetest.register_node("homedecor:door_"..doorname.."_top_"..side, { - description = doordesc.." (Top Half, "..side.."-opening)", + description = doordesc.." "..S("(Top Half, %s-opening)"):format(side), drawtype = "nodebox", tiles = tiles_top, paramtype = "light", @@ -138,7 +147,7 @@ for i in ipairs(sides) do }) minetest.register_node("homedecor:door_"..doorname.."_bottom_"..side, { - description = doordesc.." ("..side.."-opening)", + description = doordesc.." "..S("(%s-opening)"):format(side), drawtype = "nodebox", tiles = tiles_bottom, inventory_image = "homedecor_door_"..doorname.."_"..side.."_inv.png", @@ -184,7 +193,7 @@ function homedecor_place_door(itemstack, placer, pointed_thing, name, side) if field == nil then fdir = minetest.dir_to_facedir(placer:get_look_dir()) if minetest.env:get_node({x=pos.x, y=pos.y+1, z=pos.z}).name ~= "air" then - minetest.chat_send_player( placer:get_player_name(), 'Not enough vertical space to place a door!' ) + minetest.chat_send_player( placer:get_player_name(), S('Not enough vertical space to place a door!') ) return end minetest.env:add_node({x=pos.x, y=pos.y+1, z=pos.z}, { name = "homedecor:door_"..name.."_top_"..side, param2=fdir}) diff --git a/fences.lua b/fences.lua index c02a2de..1904c5c 100644 --- a/fences.lua +++ b/fences.lua @@ -1,7 +1,16 @@ -- This file adds fences of various types +-- Boilerplate to support localized strings if intllib mod is installed. +local S +if (minetest.get_modpath("intllib")) then + dofile(minetest.get_modpath("intllib").."/intllib.lua") + S = intllib.Getter(minetest.get_current_modname()) +else + S = function ( s ) return s end +end + minetest.register_node("homedecor:fence_brass", { - description = "Brass Fence/railing", + description = S("Brass Fence/railing"), drawtype = "fencelike", tiles = {"homedecor_tile_brass.png"}, inventory_image = "homedecor_fence_brass.png", @@ -23,7 +32,7 @@ minetest.register_node("homedecor:fence_brass", { itemstack:take_item() return itemstack else - print("want to simply place the wielded item like usual.") + print(S("want to simply place the wielded item like usual.")) -- What goes here if I want to just place the wielded node (dirt, cobble, etc) normally? end end @@ -41,7 +50,7 @@ minetest.register_node("homedecor:fence_brass", { }) minetest.register_node("homedecor:fence_wrought_iron", { - description = "Wrought Iron Fence/railing", + description = S("Wrought Iron Fence/railing"), drawtype = "fencelike", tiles = {"homedecor_tile_wrought_iron.png"}, inventory_image = "homedecor_fence_wrought_iron.png", @@ -64,7 +73,7 @@ minetest.register_node("homedecor:fence_wrought_iron", { clicker:set_wielded_item(itemstack) return itemstack else - print("want to simply place the wielded item like usual.") + print(S("want to simply place the wielded item like usual.")) -- What goes here if I want to just place the wielded node (dirt, cobble, etc) normally? end end @@ -84,7 +93,7 @@ minetest.register_node("homedecor:fence_wrought_iron", { -- brass/wrought iron with signs: minetest.register_node("homedecor:fence_brass_with_sign", { - description = "Brass Fence/railing with sign", + description = S("Brass Fence/railing with sign"), drawtype = "nodebox", tiles = { "homedecor_sign_brass_post_top.png", @@ -136,7 +145,7 @@ minetest.register_node("homedecor:fence_brass_with_sign", { }) minetest.register_node("homedecor:fence_wrought_iron_with_sign", { - description = "Wrought Iron Fence/railing with sign", + description = S("Wrought Iron Fence/railing with sign"), drawtype = "nodebox", tiles = { "homedecor_sign_wrought_iron_post_top.png", @@ -191,7 +200,7 @@ minetest.register_node("homedecor:fence_wrought_iron_with_sign", { minetest.register_node("homedecor:fence_picket", { drawtype = "nodebox", - description = "Unpainted Picket Fence", + description = S("Unpainted Picket Fence"), tiles = { "homedecor_fence_picket.png", "homedecor_fence_picket.png", @@ -220,7 +229,7 @@ minetest.register_node("homedecor:fence_picket", { minetest.register_node("homedecor:fence_picket_white", { drawtype = "nodebox", - description = "White Picket Fence", + description = S("White Picket Fence"), tiles = { "homedecor_fence_picket_white.png", "homedecor_fence_picket_white.png", @@ -249,7 +258,7 @@ minetest.register_node("homedecor:fence_picket_white", { minetest.register_node("homedecor:fence_privacy", { drawtype = "nodebox", - description = "Wooden Privacy Fence", + description = S("Wooden Privacy Fence"), tiles = { "homedecor_fence_privacy_tb.png", "homedecor_fence_privacy_tb.png", @@ -281,7 +290,7 @@ minetest.register_node("homedecor:fence_privacy", { minetest.register_node("homedecor:fence_barbed_wire", { drawtype = "nodebox", - description = "Barbed Wire Fence", + description = S("Barbed Wire Fence"), tiles = {"homedecor_fence_barbed_wire.png"}, paramtype = "light", is_ground_content = true, @@ -305,7 +314,7 @@ minetest.register_node("homedecor:fence_barbed_wire", { minetest.register_node("homedecor:fence_chainlink", { drawtype = "nodebox", - description = "Chainlink Fence", + description = S("Chainlink Fence"), tiles = { "homedecor_fence_chainlink_tb.png", "homedecor_fence_chainlink_tb.png", @@ -342,7 +351,7 @@ minetest.register_node("homedecor:fence_chainlink", { minetest.register_node("homedecor:fence_picket_gate_closed", { drawtype = "nodebox", - description = "Unpainted Picket Fence Gate", + description = S("Unpainted Picket Fence Gate"), tiles = { "homedecor_fence_picket_gate.png", "homedecor_fence_picket_gate.png", @@ -371,7 +380,7 @@ minetest.register_node("homedecor:fence_picket_gate_closed", { minetest.register_node("homedecor:fence_picket_gate_open", { drawtype = "nodebox", - description = "Unpainted Picket Fence Gate", + description = S("Unpainted Picket Fence Gate"), tiles = { "homedecor_fence_picket_gate.png", "homedecor_fence_picket_gate.png", @@ -401,7 +410,7 @@ minetest.register_node("homedecor:fence_picket_gate_open", { minetest.register_node("homedecor:fence_picket_gate_white_closed", { drawtype = "nodebox", - description = "White Picket Fence Gate", + description = S("White Picket Fence Gate"), tiles = { "homedecor_fence_picket_gate_white.png", "homedecor_fence_picket_gate_white.png", @@ -430,7 +439,7 @@ minetest.register_node("homedecor:fence_picket_gate_white_closed", { minetest.register_node("homedecor:fence_picket_gate_white_open", { drawtype = "nodebox", - description = "White Picket Fence Gate", + description = S("White Picket Fence Gate"), tiles = { "homedecor_fence_picket_gate_white.png", "homedecor_fence_picket_gate_white.png", @@ -460,7 +469,7 @@ minetest.register_node("homedecor:fence_picket_gate_white_open", { minetest.register_node("homedecor:fence_barbed_wire_gate_closed", { drawtype = "nodebox", - description = "Barbed Wire Fence Gate", + description = S("Barbed Wire Fence Gate"), tiles = { "homedecor_fence_barbed_wire_gate_edges.png", "homedecor_fence_barbed_wire_gate_edges.png", @@ -493,7 +502,7 @@ minetest.register_node("homedecor:fence_barbed_wire_gate_closed", { minetest.register_node("homedecor:fence_barbed_wire_gate_open", { drawtype = "nodebox", - description = "Barbed Wire Fence Gate", + description = S("Barbed Wire Fence Gate"), tiles = { "homedecor_fence_barbed_wire_gate_edges.png", "homedecor_fence_barbed_wire_gate_edges.png", @@ -527,7 +536,7 @@ minetest.register_node("homedecor:fence_barbed_wire_gate_open", { minetest.register_node("homedecor:fence_chainlink_gate_closed", { drawtype = "nodebox", - description = "Chainlink Fence Gate", + description = S("Chainlink Fence Gate"), tiles = { "homedecor_fence_chainlink_gate_tb.png", "homedecor_fence_chainlink_gate_tb.png", @@ -561,7 +570,7 @@ minetest.register_node("homedecor:fence_chainlink_gate_closed", { minetest.register_node("homedecor:fence_chainlink_gate_open", { drawtype = "nodebox", - description = "Chainlink Fence Gate (open)", + description = S("Chainlink Fence Gate (open)"), tiles = { "homedecor_fence_chainlink_gate_tb.png", "homedecor_fence_chainlink_gate_tb.png", diff --git a/init.lua b/init.lua index e3c49dd..43c4fa7 100644 --- a/init.lua +++ b/init.lua @@ -13,6 +13,15 @@ local DEBUG = 0 +-- Boilerplate to support localized strings if intllib mod is installed. +local S +if (minetest.get_modpath("intllib")) then + dofile(minetest.get_modpath("intllib").."/intllib.lua") + S = intllib.Getter(minetest.get_current_modname()) +else + S = function ( s ) return s end +end + -- Various Functions local dbg = function(s) @@ -31,19 +40,19 @@ function homedecor_node_is_owned(pos, placer) elseif type(GetNodeOwnerName) == "function" then -- ...is a recent version ownername = GetNodeOwnerName(pos) else - ownername = "someone" + ownername = S("someone") end end end elseif type(isprotect)=="function" then -- glomie's protection mod if not isprotect(5, pos, placer) then - ownername = "someone" + ownername = S("someone") end end if ownername ~= false then - minetest.chat_send_player( placer:get_player_name(), "Sorry, "..ownername.." owns that spot." ) + minetest.chat_send_player( placer:get_player_name(), S("Sorry, %s owns that spot."):format(ownername) ) return true else return false @@ -53,7 +62,7 @@ end -- Nodes minetest.register_node('homedecor:shingles_wood', { - description = "Wood Shingles", + description = S("Wood Shingles"), drawtype = 'raillike', tiles = { 'homedecor_shingles_wood.png' }, wield_image = 'homedecor_shingles_wood.png', @@ -66,7 +75,7 @@ minetest.register_node('homedecor:shingles_wood', { }) minetest.register_node('homedecor:skylight', { - description = "Glass Skylight", + description = S("Glass Skylight"), drawtype = 'raillike', tiles = { 'default_glass.png' }, wield_image = 'default_glass.png', @@ -79,7 +88,7 @@ minetest.register_node('homedecor:skylight', { }) minetest.register_node('homedecor:shingles_asphalt', { - description = "Asphalt Shingles", + description = S("Asphalt Shingles"), drawtype = 'raillike', tiles = { 'homedecor_shingles_asphalt.png' }, wield_image = 'homedecor_shingles_asphalt.png', @@ -92,7 +101,7 @@ minetest.register_node('homedecor:shingles_asphalt', { }) minetest.register_node('homedecor:shingles_terracotta', { - description = "Terracotta Roofing", + description = S("Terracotta Roofing"), drawtype = 'raillike', tiles = { 'homedecor_shingles_terracotta.png' }, wield_image = 'homedecor_shingles_terracotta.png', @@ -107,7 +116,7 @@ minetest.register_node('homedecor:shingles_terracotta', { }) minetest.register_node('homedecor:projection_screen', { - description = "Projection Screen Material", + description = S("Projection Screen Material"), drawtype = 'signlike', tiles = { 'homedecor_projection_screen.png' }, wield_image = 'homedecor_projection_screen_inv.png', @@ -125,7 +134,7 @@ minetest.register_node('homedecor:projection_screen', { }) minetest.register_node('homedecor:ceiling_paint', { - description = "Textured Ceiling Paint", + description = S("Textured Ceiling Paint"), drawtype = 'signlike', tiles = { 'homedecor_ceiling_paint.png' }, inventory_image = 'homedecor_ceiling_paint_roller.png', @@ -144,7 +153,7 @@ minetest.register_node('homedecor:ceiling_paint', { }) minetest.register_node('homedecor:ceiling_tile', { - description = "Drop-Ceiling Tile", + description = S("Drop-Ceiling Tile"), drawtype = 'signlike', tiles = { 'homedecor_ceiling_tile.png' }, wield_image = 'homedecor_ceiling_tile.png', @@ -163,7 +172,7 @@ minetest.register_node('homedecor:ceiling_tile', { }) minetest.register_node('homedecor:rug_small', { - description = "Small Throw Rug", + description = S("Small Throw Rug"), drawtype = 'signlike', tiles = { 'homedecor_rug_small.png' }, wield_image = 'homedecor_rug_small.png', @@ -184,7 +193,7 @@ minetest.register_node('homedecor:rug_small', { }) minetest.register_node('homedecor:rug_large', { - description = "Large Area Rug", + description = S("Large Area Rug"), drawtype = 'signlike', tiles = { 'homedecor_rug_large.png' }, wield_image = 'homedecor_rug_large.png', @@ -205,7 +214,7 @@ minetest.register_node('homedecor:rug_large', { }) minetest.register_node('homedecor:glass_table_large', { - description = "Large Glass Table Piece", + description = S("Large Glass Table Piece"), drawtype = 'signlike', tiles = { 'homedecor_glass_table_large.png' }, wield_image = 'homedecor_glass_table_large.png', @@ -226,7 +235,7 @@ minetest.register_node('homedecor:glass_table_large', { }) minetest.register_node('homedecor:glass_table_small_round', { - description = "Glass Table (Small, Round)", + description = S("Glass Table (Small, Round)"), drawtype = 'signlike', tiles = { 'homedecor_glass_table_small_round.png' }, wield_image = 'homedecor_glass_table_small_round.png', @@ -247,7 +256,7 @@ minetest.register_node('homedecor:glass_table_small_round', { }) minetest.register_node('homedecor:glass_table_small_square', { - description = "Glass Table (Small, Square)", + description = S("Glass Table (Small, Square)"), drawtype = 'signlike', tiles = { 'homedecor_glass_table_small_square.png' }, wield_image = 'homedecor_glass_table_small_square.png', @@ -268,7 +277,7 @@ minetest.register_node('homedecor:glass_table_small_square', { }) minetest.register_node("homedecor:table_legs_brass", { - description = "Brass Table Legs", + description = S("Brass Table Legs"), drawtype = "plantlike", tiles = {"homedecor_table_legs_brass.png"}, inventory_image = "homedecor_table_legs_brass.png", @@ -282,7 +291,7 @@ minetest.register_node("homedecor:table_legs_brass", { }) minetest.register_node("homedecor:table_legs_wrought_iron", { - description = "Brass Table Legs", + description = S("Brass Table Legs"), drawtype = "plantlike", tiles = {"homedecor_table_legs_wrought_iron.png"}, inventory_image = "homedecor_table_legs_wrought_iron.png", @@ -296,7 +305,7 @@ minetest.register_node("homedecor:table_legs_wrought_iron", { }) minetest.register_node('homedecor:stereo', { - description = "Stereo Receiver", + description = S("Stereo Receiver"), tiles = { 'homedecor_stereo_top.png', 'homedecor_stereo_bottom.png', 'homedecor_stereo_right.png', @@ -312,7 +321,7 @@ minetest.register_node('homedecor:stereo', { }) minetest.register_node('homedecor:utility_table_top', { - description = "Utility Table", + description = S("Utility Table"), tiles = { 'homedecor_utility_table_top.png' }, inventory_image = 'homedecor_utility_table_top.png', wield_image = 'homedecor_utility_table_top.png', @@ -335,7 +344,7 @@ minetest.register_node('homedecor:utility_table_top', { }) minetest.register_node('homedecor:utility_table_legs', { - description = "Legs for Utility Table", + description = S("Legs for Utility Table"), tiles = { 'homedecor_utility_table_legs.png' }, inventory_image = 'homedecor_utility_table_legs_inv.png', wield_image = 'homedecor_utility_table_legs.png', @@ -350,7 +359,7 @@ minetest.register_node('homedecor:utility_table_legs', { }) minetest.register_node('homedecor:flower_pot_terracotta', { - description = "Terracotta Flower Pot", + description = S("Terracotta Flower Pot"), tiles = { 'homedecor_flower_pot_terracotta_top.png', 'homedecor_flower_pot_terracotta_bottom.png', 'homedecor_flower_pot_terracotta_sides.png', @@ -366,7 +375,7 @@ minetest.register_node('homedecor:flower_pot_terracotta', { }) minetest.register_node('homedecor:flower_pot_black', { - description = "Black Plastic Flower Pot", + description = S("Black Plastic Flower Pot"), tiles = { 'homedecor_flower_pot_black_top.png', 'homedecor_flower_pot_black_bottom.png', 'homedecor_flower_pot_black_sides.png', @@ -382,7 +391,7 @@ minetest.register_node('homedecor:flower_pot_black', { }) minetest.register_node('homedecor:flower_pot_green', { - description = "Green Plastic Flower Pot", + description = S("Green Plastic Flower Pot"), tiles = { 'homedecor_flower_pot_green_top.png', 'homedecor_flower_pot_green_bottom.png', 'homedecor_flower_pot_green_sides.png', @@ -398,7 +407,7 @@ minetest.register_node('homedecor:flower_pot_green', { }) minetest.register_node('homedecor:wood_table_large', { - description = "Wooden Tabletop piece", + description = S("Wooden Tabletop piece"), tiles = { 'homedecor_wood_table_large.png' }, inventory_image = 'homedecor_wood_table_large.png', wield_image = 'homedecor_wood_table_large.png', @@ -419,7 +428,7 @@ minetest.register_node('homedecor:wood_table_large', { }) minetest.register_node('homedecor:wood_table_small_round', { - description = "Wooden Tabletop (Small, Round)", + description = S("Wooden Tabletop (Small, Round)"), tiles = { 'homedecor_wood_table_small_round.png' }, inventory_image = 'homedecor_wood_table_small_round.png', wield_image = 'homedecor_wood_table_small_round.png', @@ -440,7 +449,7 @@ minetest.register_node('homedecor:wood_table_small_round', { }) minetest.register_node('homedecor:wood_table_small_square', { - description = "Wooden Tabletop (Small, Square)", + description = S("Wooden Tabletop (Small, Square)"), tiles = { 'homedecor_wood_table_small_square.png' }, inventory_image = 'homedecor_wood_table_small_square.png', wield_image = 'homedecor_wood_table_small_square.png', @@ -461,7 +470,7 @@ minetest.register_node('homedecor:wood_table_small_square', { }) minetest.register_node('homedecor:shutter_black', { - description = "Wooden Shutter (Black)", + description = S("Wooden Shutter (Black)"), tiles = { 'homedecor_window_shutter_black.png' }, inventory_image = 'homedecor_window_shutter_black.png', wield_image = 'homedecor_window_shutter_black.png', @@ -480,7 +489,7 @@ minetest.register_node('homedecor:shutter_black', { }) minetest.register_node('homedecor:shutter_mahogany', { - description = "Wooden Shutter (Unpainted Mahogany)", + description = S("Wooden Shutter (Unpainted Mahogany)"), tiles = { 'homedecor_window_shutter_mahogany.png' }, inventory_image = 'homedecor_window_shutter_mahogany.png', wield_image = 'homedecor_window_shutter_mahogany.png', @@ -499,7 +508,7 @@ minetest.register_node('homedecor:shutter_mahogany', { }) minetest.register_node('homedecor:shutter_oak', { - description = "Wooden Shutter (Unpainted Oak)", + description = S("Wooden Shutter (Unpainted Oak)"), tiles = { 'homedecor_window_shutter_oak.png' }, inventory_image = 'homedecor_window_shutter_oak.png', wield_image = 'homedecor_window_shutter_oak.png', @@ -518,7 +527,7 @@ minetest.register_node('homedecor:shutter_oak', { }) minetest.register_node('homedecor:shutter_dark_grey', { - description = "Wooden Shutter (Dark Grey)", + description = S("Wooden Shutter (Dark Grey)"), tiles = { 'homedecor_window_shutter_dark_grey.png' }, inventory_image = 'homedecor_window_shutter_dark_grey.png', wield_image = 'homedecor_window_shutter_dark_grey.png', @@ -537,7 +546,7 @@ minetest.register_node('homedecor:shutter_dark_grey', { }) minetest.register_node('homedecor:shutter_forest_green', { - description = "Wooden Shutter (Forest Green)", + description = S("Wooden Shutter (Forest Green)"), tiles = { 'homedecor_window_shutter_forest_green.png' }, inventory_image = 'homedecor_window_shutter_forest_green.png', wield_image = 'homedecor_window_shutter_forest_green.png', @@ -556,7 +565,7 @@ minetest.register_node('homedecor:shutter_forest_green', { }) minetest.register_node('homedecor:shutter_grey', { - description = "Wooden Shutter (Grey)", + description = S("Wooden Shutter (Grey)"), tiles = { 'homedecor_window_shutter_grey.png' }, inventory_image = 'homedecor_window_shutter_grey.png', wield_image = 'homedecor_window_shutter_grey.png', @@ -575,7 +584,7 @@ minetest.register_node('homedecor:shutter_grey', { }) minetest.register_node('homedecor:shutter_light_blue', { - description = "Wooden Shutter (Light Blue)", + description = S("Wooden Shutter (Light Blue)"), tiles = { 'homedecor_window_shutter_light_blue.png' }, inventory_image = 'homedecor_window_shutter_light_blue.png', wield_image = 'homedecor_window_shutter_light_blue.png', @@ -594,7 +603,7 @@ minetest.register_node('homedecor:shutter_light_blue', { }) minetest.register_node('homedecor:shutter_purple', { - description = "Wooden Shutter (Purple)", + description = S("Wooden Shutter (Purple)"), tiles = { 'homedecor_window_shutter_purple.png' }, inventory_image = 'homedecor_window_shutter_purple.png', wield_image = 'homedecor_window_shutter_purple.png', @@ -613,7 +622,7 @@ minetest.register_node('homedecor:shutter_purple', { }) minetest.register_node('homedecor:shutter_red', { - description = "Wooden Shutter (Red)", + description = S("Wooden Shutter (Red)"), tiles = { 'homedecor_window_shutter_red.png' }, inventory_image = 'homedecor_window_shutter_red.png', wield_image = 'homedecor_window_shutter_red.png', @@ -632,7 +641,7 @@ minetest.register_node('homedecor:shutter_red', { }) minetest.register_node('homedecor:shutter_white', { - description = "Wooden Shutter (White)", + description = S("Wooden Shutter (White)"), tiles = { 'homedecor_window_shutter_white.png' }, inventory_image = 'homedecor_window_shutter_white.png', wield_image = 'homedecor_window_shutter_white.png', @@ -651,7 +660,7 @@ minetest.register_node('homedecor:shutter_white', { }) minetest.register_node('homedecor:shutter_yellow', { - description = "Wooden Shutter (Yellow)", + description = S("Wooden Shutter (Yellow)"), tiles = { 'homedecor_window_shutter_yellow.png' }, inventory_image = 'homedecor_window_shutter_yellow.png', wield_image = 'homedecor_window_shutter_yellow.png', @@ -671,7 +680,7 @@ minetest.register_node('homedecor:shutter_yellow', { minetest.register_node('homedecor:utilitytable2', { - description = "Utility table mk2", + description = S("Utility table mk2"), tiles = { 'homedecor_utility_table_top.png', 'homedecor_blanktile.png', 'homedecor_utility_table_legs.png', @@ -699,7 +708,7 @@ for i = 1, detail-1 do end minetest.register_node("homedecor:pole_brass", { - description = "Brass Pole", + description = S("Brass Pole"), drawtype = "nodebox", tiles = {"homedecor_tile_brass2.png"}, inventory_image = "homedecor_pole_brass2.png", @@ -720,7 +729,7 @@ minetest.register_node("homedecor:pole_brass", { }) minetest.register_node("homedecor:pole_wrought_iron", { - description = "Wrought Iron Pole", + description = S("Wrought Iron Pole"), drawtype = "nodebox", tiles = {"homedecor_tile_wrought_iron2.png"}, inventory_image = "homedecor_pole_wrought_iron.png", @@ -741,7 +750,7 @@ minetest.register_node("homedecor:pole_wrought_iron", { }) minetest.register_node('homedecor:speaker', { - description = "Large Stereo Speaker", + description = S("Large Stereo Speaker"), tiles = { 'homedecor_speaker_top.png', 'homedecor_speaker_bottom.png', 'homedecor_speaker_right.png', @@ -757,7 +766,7 @@ minetest.register_node('homedecor:speaker', { }) minetest.register_node('homedecor:speaker_small', { - description = "Small Surround Speaker", + description = S("Small Surround Speaker"), drawtype = "nodebox", tiles = { 'homedecor_speaker_top.png', @@ -796,10 +805,10 @@ local curtaincolors = { } for c in ipairs(curtaincolors) do - local color = curtaincolors[c] + local color = S(curtaincolors[c]) minetest.register_node("homedecor:curtain_"..color, { - description = "Curtains ("..color..")", + description = S("Curtains (%s)"):format(color), tiles = { "homedecor_curtain_"..color..".png" }, inventory_image = "homedecor_curtain_"..color..".png", wield_image = "homedecor_curtain_"..color..".png", @@ -836,4 +845,4 @@ dofile(minetest.get_modpath("homedecor").."/crafts.lua") dofile(minetest.get_modpath("homedecor").."/locked.lua") -print("[HomeDecor] Loaded!") +print("[HomeDecor] "..S("Loaded!")) diff --git a/kitchen_cabinet.lua b/kitchen_cabinet.lua index 06fe314..116ef37 100644 --- a/kitchen_cabinet.lua +++ b/kitchen_cabinet.lua @@ -1,7 +1,16 @@ -- This file supplies Kitchen cabinets and kitchen sink +-- Boilerplate to support localized strings if intllib mod is installed. +local S +if (minetest.get_modpath("intllib")) then + dofile(minetest.get_modpath("intllib").."/intllib.lua") + S = intllib.Getter(minetest.get_current_modname()) +else + S = function ( s ) return s end +end + minetest.register_node('homedecor:kitchen_cabinet', { - description = "Kitchen Cabinet", + description = S("Kitchen Cabinet"), tiles = { 'homedecor_kitchen_cabinet_top.png', 'homedecor_kitchen_cabinet_bottom.png', 'homedecor_kitchen_cabinet_sides.png', @@ -20,7 +29,7 @@ minetest.register_node('homedecor:kitchen_cabinet', { "size[8,8]".. "list[current_name;main;0,0;8,3;]".. "list[current_player;main;0,4;8,4;]") - meta:set_string("infotext", "Kitchen cabinet") + meta:set_string("infotext", S("Kitchen Cabinet")) local inv = meta:get_inventory() inv:set_size("main", 24) end, @@ -30,16 +39,22 @@ minetest.register_node('homedecor:kitchen_cabinet', { return inv:is_empty("main") end, on_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player) - minetest.log("action", player:get_player_name().. - " moves stuff in kitchen cabinet at "..minetest.pos_to_string(pos)) + minetest.log("action", S("%s moves stuff in kitchen cabinet at %s"):format( + player:get_player_name(), + minetest.pos_to_string(pos) + )) end, on_metadata_inventory_put = function(pos, listname, index, stack, player) - minetest.log("action", player:get_player_name().. - " moves stuff to kitchen cabinet at "..minetest.pos_to_string(pos)) + minetest.log("action", S("%s moves stuff to kitchen cabinet at %s"):format( + player:get_player_name(), + minetest.pos_to_string(pos) + )) end, on_metadata_inventory_take = function(pos, listname, index, stack, player) - minetest.log("action", player:get_player_name().. - " takes stuff from kitchen cabinet at "..minetest.pos_to_string(pos)) + minetest.log("action", S("%s takes stuff from kitchen cabinet at %s"):format( + player:get_player_name(), + minetest.pos_to_string(pos) + )) end, }) @@ -72,7 +87,7 @@ minetest.register_node('homedecor:kitchen_cabinet_half', { "size[8,7]".. "list[current_name;main;1,0;6,2;]".. "list[current_player;main;0,3;8,4;]") - meta:set_string("infotext", "Kitchen cabinet") + meta:set_string("infotext", S("Kitchen Cabinet")) local inv = meta:get_inventory() inv:set_size("main", 12) end, @@ -82,23 +97,28 @@ minetest.register_node('homedecor:kitchen_cabinet_half', { return inv:is_empty("main") end, on_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player) - minetest.log("action", player:get_player_name().. - " moves stuff in kitchen cabinet at "..minetest.pos_to_string(pos)) + minetest.log("action", S("%s moves stuff in kitchen cabinet at %s"):format( + player:get_player_name(), + minetest.pos_to_string(pos) + )) end, on_metadata_inventory_put = function(pos, listname, index, stack, player) - minetest.log("action", player:get_player_name().. - " moves stuff to kitchen cabinet at "..minetest.pos_to_string(pos)) + minetest.log("action", S("%s moves stuff to kitchen cabinet at %s"):format( + player:get_player_name(), + minetest.pos_to_string(pos) + )) end, on_metadata_inventory_take = function(pos, listname, index, stack, player) - minetest.log("action", player:get_player_name().. - " takes stuff from kitchen cabinet at "..minetest.pos_to_string(pos)) + minetest.log("action", S("%s takes stuff from kitchen cabinet at %s"):format( + player:get_player_name(), + minetest.pos_to_string(pos) + )) end, }) - minetest.register_node('homedecor:kitchen_cabinet_with_sink', { - description = "Kitchen Cabinet with sink", + description = S("Kitchen Cabinet with sink"), tiles = { 'homedecor_kitchen_cabinet_sinktop.png', 'homedecor_kitchen_cabinet_bottom.png', 'homedecor_kitchen_cabinet_sides.png', @@ -117,7 +137,7 @@ minetest.register_node('homedecor:kitchen_cabinet_with_sink', { "size[8,7]".. "list[current_name;main;0,0;8,2;]".. "list[current_player;main;0,3;8,4;]") - meta:set_string("infotext", "Under-sink cabinet") + meta:set_string("infotext", S("Under-sink cabinet")) local inv = meta:get_inventory() inv:set_size("main", 16) end, @@ -127,16 +147,21 @@ minetest.register_node('homedecor:kitchen_cabinet_with_sink', { return inv:is_empty("main") end, on_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player) - minetest.log("action", player:get_player_name().. - " moves stuff in under-sink cabinet at "..minetest.pos_to_string(pos)) + minetest.log("action", S("%s moves stuff in kitchen cabinet at %s"):format( + player:get_player_name(), + minetest.pos_to_string(pos) + )) end, on_metadata_inventory_put = function(pos, listname, index, stack, player) - minetest.log("action", player:get_player_name().. - " moves stuff to under-sink cabinet at "..minetest.pos_to_string(pos)) + minetest.log("action", S("%s moves stuff to kitchen cabinet at %s"):format( + player:get_player_name(), + minetest.pos_to_string(pos) + )) end, on_metadata_inventory_take = function(pos, listname, index, stack, player) - minetest.log("action", player:get_player_name().. - " takes stuff from under-sink cabinet at "..minetest.pos_to_string(pos)) + minetest.log("action", S("%s takes stuff from kitchen cabinet at %s"):format( + player:get_player_name(), + minetest.pos_to_string(pos) + )) end, }) - diff --git a/lighting.lua b/lighting.lua index 79f7c42..e73dcda 100644 --- a/lighting.lua +++ b/lighting.lua @@ -1,10 +1,19 @@ -- This file supplies glowlights +-- Boilerplate to support localized strings if intllib mod is installed. +local S +if (minetest.get_modpath("intllib")) then + dofile(minetest.get_modpath("intllib").."/intllib.lua") + S = intllib.Getter(minetest.get_current_modname()) +else + S = function ( s ) return s end +end + -- Yellow minetest.register_node('homedecor:glowlight_thick_yellow', { - description = "Yellow Glowlight (thick)", + description = S("Yellow Glowlight (thick)"), drawtype = "nodebox", tiles = { 'homedecor_glowlight_yellow_tb.png', @@ -32,7 +41,7 @@ minetest.register_node('homedecor:glowlight_thick_yellow', { }) minetest.register_node('homedecor:glowlight_thick_yellow_wall', { - description = "Yellow Glowlight (thick, on wall)", + description = S("Yellow Glowlight (thick, on wall)"), drawtype = "nodebox", tiles = { 'homedecor_glowlight_thick_yellow_sides.png', @@ -60,7 +69,7 @@ minetest.register_node('homedecor:glowlight_thick_yellow_wall', { }) minetest.register_node('homedecor:glowlight_thin_yellow', { - description = "Yellow Glowlight (thin)", + description = S("Yellow Glowlight (thin)"), drawtype = "nodebox", tiles = { 'homedecor_glowlight_yellow_tb.png', @@ -88,7 +97,7 @@ minetest.register_node('homedecor:glowlight_thin_yellow', { }) minetest.register_node('homedecor:glowlight_thin_yellow_wall', { - description = "Yellow Glowlight (thin, on wall)", + description = S("Yellow Glowlight (thin, on wall)"), drawtype = "nodebox", tiles = { 'homedecor_glowlight_thin_yellow_sides.png', @@ -116,7 +125,7 @@ minetest.register_node('homedecor:glowlight_thin_yellow_wall', { }) minetest.register_node('homedecor:glowlight_small_cube_yellow', { - description = "Yellow Glowlight (small cube)", + description = S("Yellow Glowlight (small cube)"), drawtype = "nodebox", tiles = { 'homedecor_glowlight_cube_yellow_tb.png', @@ -144,7 +153,7 @@ minetest.register_node('homedecor:glowlight_small_cube_yellow', { }) minetest.register_node('homedecor:glowlight_small_cube_yellow_ceiling', { - description = "Yellow Glowlight (small cube, on ceiling)", + description = S("Yellow Glowlight (small cube, on ceiling)"), drawtype = "nodebox", tiles = { 'homedecor_glowlight_cube_yellow_tb.png', @@ -174,7 +183,7 @@ minetest.register_node('homedecor:glowlight_small_cube_yellow_ceiling', { -- White minetest.register_node('homedecor:glowlight_thick_white', { - description = "White Glowlight (thick)", + description = S("White Glowlight (thick)"), drawtype = "nodebox", tiles = { 'homedecor_glowlight_white_tb.png', @@ -202,7 +211,7 @@ minetest.register_node('homedecor:glowlight_thick_white', { }) minetest.register_node('homedecor:glowlight_thick_white_wall', { - description = "White Glowlight (thick, on wall)", + description = S("White Glowlight (thick, on wall)"), drawtype = "nodebox", tiles = { 'homedecor_glowlight_thick_white_sides.png', @@ -230,7 +239,7 @@ minetest.register_node('homedecor:glowlight_thick_white_wall', { }) minetest.register_node('homedecor:glowlight_thin_white', { - description = "White Glowlight (thin)", + description = S("White Glowlight (thin)"), drawtype = "nodebox", tiles = { 'homedecor_glowlight_white_tb.png', @@ -258,7 +267,7 @@ minetest.register_node('homedecor:glowlight_thin_white', { }) minetest.register_node('homedecor:glowlight_thin_white_wall', { - description = "White Glowlight (thin, on wall)", + description = S("White Glowlight (thin, on wall)"), drawtype = "nodebox", tiles = { 'homedecor_glowlight_thin_white_sides.png', @@ -286,7 +295,7 @@ minetest.register_node('homedecor:glowlight_thin_white_wall', { }) minetest.register_node('homedecor:glowlight_small_cube_white', { - description = "White Glowlight (small cube)", + description = S("White Glowlight (small cube)"), drawtype = "nodebox", tiles = { 'homedecor_glowlight_cube_white_tb.png', @@ -314,7 +323,7 @@ minetest.register_node('homedecor:glowlight_small_cube_white', { }) minetest.register_node('homedecor:glowlight_small_cube_white_ceiling', { - description = "White Glowlight (small cube, on ceiling)", + description = S("White Glowlight (small cube, on ceiling)"), drawtype = "nodebox", tiles = { 'homedecor_glowlight_cube_white_tb.png', diff --git a/locale/es.txt b/locale/es.txt new file mode 100644 index 0000000..96a1e3f --- /dev/null +++ b/locale/es.txt @@ -0,0 +1,178 @@ + +# +# Language: Español +# Author: Diego Martínez +# + +### kitchen_cabinet.lua ### +Kitchen Cabinet = Gabinete de Cocina +## 1: Player name, 2: position +%s moves stuff in kitchen cabinet at %s = %s mueve cosas en gabinete de cocina en %s +%s moves stuff to kitchen cabinet at %s = %s mueve cosas al gabinete de cocina en %s +%s takes stuff from kitchen cabinet at %s = %s toma cosas del gabinete de cocina en %s +Half-height Kitchen Cabinet (on ceiling) = Gabinete de cocina de media altura (en techo) +Under-sink cabinet = Gabinete con Lavabo +Kitchen Cabinet with sink = Gabinete de cocina con lavabo + +### door_models.lua ### +Mahogany Closet Door = Puerta de Armario de Caoba +Oak Closet Door = Puerta de Armario de Roble +Fancy Wood/Glass Door = Puerta de Madera y Cristal de Lujo +Glass Office Door = Puerta de Oficina de Cristal +Glass and Wood, Mahogany-colored = Cristal y Madera, color Caoba +Glass and Wood, Oak-colored = Cristal y Madera, color Roble +Glass and Wood, White = Cristal y Madera, color Blanco +Plain Wooden Door = Puerta Simple de Madera +left = izquierda +right = derecha +## 1: Side the doors opens to +(Top Half, %s-opening) = (Parte Superior, abre a la %s) +(%s-opening) = (abre a la %s) + +### door_nodes.lua ### +Not enough vertical space to place a door! = ¡No hay suficiente espacio vertical para colocar una puerta! + +### crafts.lua ### +Brass Ingot = Lingote de Latón +Bucket of white paint = Cubo de Pintura Blanca +Legs for Small Utility table = Patas de Mesa Utilitaria Pequeña +Plastic sheet = Lámina de Plástico +Silicon lump = Terrón de Silicio +Simple Integrated Circuit = Circuito Integrado Simple +Small Wooden Drawer = Cajón Pequeño de Madera +Terracotta Roof Tile = Teja de Terracota +Titanium Dioxide = Dióxido de Titanio +Uncooked Terracotta Base = Base de Terracota sin Cocer +Unprocessed Plastic base = Base de Plástico sin Procesar + +### fences.lua ### +Barbed Wire Fence = Cerca de Alambre de Púas +Barbed Wire Fence Gate = Portón de Cerca de Alambre de Púas +Brass Fence/railing = Cerca/Barandilla de Latón +Brass Fence/railing with sign = Cerca/Barandilla de Latón con Letrero +Chainlink Fence = Cerca de Cadenas +Chainlink Fence Gate = Portón de Cerca de Cadenas +Chainlink Fence Gate (open) = Portón de Cerca de Cadenas (Abierto) +Unpainted Picket Fence = Cerca de Piquete sin pintar +Unpainted Picket Fence Gate = Portón de Cerca de Piquete sin pintar +White Picket Fence = Cerca de Piquete blanca +White Picket Fence Gate = Portón de Cerca de Piquete blanca +Wooden Privacy Fence = Cerca privada de madera +Wrought Iron Fence/railing = Cerca/Barandilla de Hierro Forjado +Wrought Iron Fence/railing with sign = Cerca/Barandilla de Hierro Forjado con Letrero +want to simply place the wielded item like usual. = solo se desea colocar el objeto empuñado normalmente. + +### init.lua ### +Loaded! = ¡Cargado! +Asphalt Shingles = Tejas de Asfalto +Black Plastic Flower Pot = Florero de Plástico Negro +Brass Pole = Poste de Latón +Brass Table Legs = Patas de Mesa de Latón +red = rojas +green = verdes +blue = azules +white = blancas +pink = rosas +violet = violetas +## 1: Color name +Curtains (%s) = Cortinas (%s) +Drop-Ceiling Tile = Cielorraso +Glass Skylight = Claraboya de Cristal +Glass Table (Small, Round) = Mesa de Cristal (Pequeña, Redonda) +Glass Table (Small, Square) = Mesa de Cristal (Pequeña, Cuadrada) +Green Plastic Flower Pot = Florero de Plástico Negro +Large Area Rug = Manta Grande +Large Glass Table Piece = Pieza de Mesa de Cristal Grande +Large Stereo Speaker = Altavoz de Estéreo Grande +Legs for Utility Table = Patas de Mesa Utilitaria +Projection Screen Material = Material de Pantalla de Proyección +Small Surround Speaker = Pequeño Altavoz Envolvente +Small Throw Rug = Manta Pequeña +Stereo Receiver = Receptor Estéreo +Terracotta Flower Pot = Florero de Terracota +Terracotta Roofing = Tejado de Terracota +Textured Ceiling Paint = Pintura Texturada para Techo +Utility Table = Mesa Utilitaria +Utility table mk2 = Mesa Utilitaria mk2 +Wooden Shutter (Black) = Obturador de Madera (Negro) +Wooden Shutter (Dark Grey) = Obturador de Madera (Gris Oscuro) +Wooden Shutter (Forest Green) = Obturador de Madera (Verde Bosque) +Wooden Shutter (Grey) = Obturador de Madera (Gris) +Wooden Shutter (Light Blue) = Obturador de Madera (Azul Claro) +Wooden Shutter (Purple) = Obturador de Madera (Púrpura) +Wooden Shutter (Red) = Obturador de Madera (Rojo) +Wooden Shutter (Unpainted Mahogany) = Obturador de Madera (Caoba sin Pintar) +Wooden Shutter (Unpainted Oak) = Obturador de Madera (Roble sin Pintar) +Wooden Shutter (White) = Obturador de Madera (Blanco) +Wooden Shutter (Yellow) = Obturador de Madera (Amarillo) +Wooden Tabletop piece = Pieza de Mesa de Madera +Wooden Tabletop (Small, Round) = Pieza de Mesa de Madera (Pequeña, Redonda) +Wooden Tabletop (Small, Square) = Pieza de Mesa de Madera (Pequeña, Cuadrada) +Wood Shingles = Tejas de Madera +Wrought Iron Pole = Poste de Hierro Forjado +someone = alguien +## 1: Player name +Sorry, %s owns that spot. = Lo siento, %s es dueño de ése lugar. + +### lighting.lua ### +White Glowlight (small cube) = Luz Blanca (cubo pequeño) +White Glowlight (small cube, on ceiling) = Luz Blanca (cubo pequeño, en techo) +White Glowlight (thick) = Luz Blanca (Gruesa) +White Glowlight (thick, on wall) = Luz Blanca (Gruesa, en pared) +White Glowlight (thin) = Luz Blanca (Fina) +White Glowlight (thin, on wall) = Luz Blanca (Fina, en pared) +Yellow Glowlight (small cube) = Luz Amarilla (cubo pequeño) +Yellow Glowlight (small cube, on ceiling) = Luz Amarilla (cubo pequeño, en techo) +Yellow Glowlight (thick) = Luz Amarilla (Gruesa) +Yellow Glowlight (thick, on wall) = Luz Amarilla (Gruesa, en pared) +Yellow Glowlight (thin) = Luz Amarilla (Fina) +Yellow Glowlight (thin, on wall) = Luz Amarilla (Fina, en pared) + +### locked.lua ### +## 1: Item description, 2: Owner name +%s (owned by %s) = %s (propiedad de %s) +## 1: Player name, 2: Item description, 3: Owner name, 4: Position +%s tried to access a %s belonging to %s at %s = %s ha intentado acceder un(a) %s propiedad de %s en %s +## 1: Item description +%s (Locked) = %s (Cerrado) +Locked Cabinet = Gabinete Cerrado +Locked Nightstand = Mesa de Noche Cerrada +Locked Fridge = Refri Cerrado +Locked Oven = Estufa Cerrada + +### nightstands.lua ### +Mahogany Nightstand with One Drawer = Mesa de Noche de Caoba, un Cajón +Mahogany Nightstand with Two Drawers = Mesa de Noche de Caoba, dos Cajones +Oak Nightstand with One Drawer = Mesa de Noche de Roble, un Cajón +Oak Nightstand with Two Drawers = Mesa de Noche de Roble, dos Cajones +## 1: Player name, 2: position +%s moves stuff in nightstand at %s = %s mueve cosas en mesa de noche en %s +%s moves stuff to nightstand at %s = %s mueve cosas hacia mesa de noche en %s +%s takes stuff from nightstand at %s = %s mueve cosas desde mesa de noche en %s +One-drawer Nightstand = Mesa de Noche de un Cajón +Two-drawer Nightstand = Mesa de Noche de dos Cajones + +### oven.lua ### +Oven = Estufa +## 1: Item name +Could not insert '%s' = No se pudo insertar '%s' +## 1: Percentage +Oven active: %d%% = Estufa activa: %d%% +Oven out of fuel = Estufa sin combustible +Oven is empty = Estufavacía + +### refrigerator.lua ### +Refrigerator = Refrigerador +## 1: Player name, 2: position +%s moves stuff in refrigerator at %s = %s mueve cosas en refrigerador en %s +%s moves stuff to refrigerator at %s = %s mueve cosas hacia refrigerador en %s +%s takes stuff from refrigerator at %s = %s mueve cosas desde refrigerador en %s +Not enough vertical space to place a refrigerator! = ¡No hay suficiente espacio vertical para colocar un refrigerador! + +### television.lua ### +Small CRT Television = Pequeña Televisión CRT + +### signs_lib.lua ### +E: character map file not found = E: archivo de mapa de caracteres no encontrado +## 1: Full String, 2: pos in string, 3: current char at pos +W: unknown symbol in '%s' at %d (probably %s) = A: símbolo desconocido en '%s' posición %d (probablemente %s) diff --git a/locale/template.txt b/locale/template.txt new file mode 100644 index 0000000..864e285 --- /dev/null +++ b/locale/template.txt @@ -0,0 +1,182 @@ + +########################## +# Template language file # +########################## + +### Special strings ### + +### kitchen_cabinet.lua ### +Kitchen Cabinet = +## 1: Player name, 2: position +%s moves stuff in kitchen cabinet at %s = +%s moves stuff to kitchen cabinet at %s = +%s takes stuff from kitchen cabinet at %s = +Half-height Kitchen Cabinet (on ceiling) = +Under-sink cabinet = +Kitchen Cabinet with sink = + +### door_models.lua ### +Mahogany Closet Door = +Oak Closet Door = +Fancy Wood/Glass Door = +Glass Office Door = +Glass and Wood, Mahogany-colored = +Glass and Wood, Oak-colored = +Glass and Wood, White = +Plain Wooden Door = +left = +right = +## 1: Side the doors opens to +(Top Half, %s-opening) = +(%s-opening) = + + +### door_nodes.lua ### +Not enough vertical space to place a door! = + +### crafts.lua ### +Brass Ingot = +Bucket of white paint = +Legs for Small Utility table = +Plastic sheet = +Silicon lump = +Simple Integrated Circuit = +Small Wooden Drawer = +Terracotta Roof Tile = +Titanium Dioxide = +Uncooked Terracotta Base = +Unprocessed Plastic base = + +### door_models.lua ### + +### door_nodes.lua ### + +### fences.lua ### +Barbed Wire Fence = +Barbed Wire Fence Gate = +Brass Fence/railing = +Brass Fence/railing with sign = +Chainlink Fence = +Chainlink Fence Gate = +Chainlink Fence Gate (open) = +Unpainted Picket Fence = +Unpainted Picket Fence Gate = +White Picket Fence = +White Picket Fence Gate = +Wooden Privacy Fence = +Wrought Iron Fence/railing = +Wrought Iron Fence/railing with sign = +want to simply place the wielded item like usual. = + +### init.lua ### +Loaded! = +Asphalt Shingles = +Black Plastic Flower Pot = +Brass Pole = +Brass Table Legs = +red = +green = +blue = +white = +pink = +violet = +## 1: Color name +Curtains (%s) = +Drop-Ceiling Tile = +Glass Skylight = +Glass Table (Small, Round) = +Glass Table (Small, Square) = +Green Plastic Flower Pot = +Large Area Rug = +Large Glass Table Piece = +Large Stereo Speaker = +Legs for Utility Table = +Projection Screen Material = +Small Surround Speaker = +Small Throw Rug = +Stereo Receiver = +Terracotta Flower Pot = +Terracotta Roofing = +Textured Ceiling Paint = +Utility Table = +Utility table mk2 = +Wooden Shutter (Black) = +Wooden Shutter (Dark Grey) = +Wooden Shutter (Forest Green) = +Wooden Shutter (Grey) = +Wooden Shutter (Light Blue) = +Wooden Shutter (Purple) = +Wooden Shutter (Red) = +Wooden Shutter (Unpainted Mahogany) = +Wooden Shutter (Unpainted Oak) = +Wooden Shutter (White) = +Wooden Shutter (Yellow) = +Wooden Tabletop piece = +Wooden Tabletop (Small, Round) = +Wooden Tabletop (Small, Square) = +Wood Shingles = +Wrought Iron Pole = +someone = +## 1: Player name +Sorry, %s owns that spot. = + +### lighting.lua ### +White Glowlight (small cube) = +White Glowlight (small cube, on ceiling) = +White Glowlight (thick) = +White Glowlight (thick, on wall) = +White Glowlight (thin) = +White Glowlight (thin, on wall) = +Yellow Glowlight (small cube) = +Yellow Glowlight (small cube, on ceiling) = +Yellow Glowlight (thick) = +Yellow Glowlight (thick, on wall) = +Yellow Glowlight (thin) = +Yellow Glowlight (thin, on wall) = + +### locked.lua ### +## 1: Item description, 2: Owner name +%s (owned by %s) = +## 1: Player name, 2: Item description, 3: Owner name, 4: Position +%s tried to access a %s belonging to %s at %s = +## 1: Item description +%s (Locked) = +Locked Cabinet = +Locked Nightstand = + +### nightstands.lua ### +Mahogany Nightstand with One Drawer = +Mahogany Nightstand with Two Drawers = +Oak Nightstand with One Drawer = +Oak Nightstand with Two Drawers = +## 1: Player name, 2: position +%s moves stuff in nightstand at %s = +%s moves stuff to nightstand at %s = +%s takes stuff from nightstand at %s = +One-drawer Nightstand = +Two-drawer Nightstand = + +### oven.lua ### +Oven = +## 1: Item name +Could not insert '%s' = +## 1: Percentage +Oven active: %d%% = +Oven out of fuel = +Oven is empty = + +### refrigerator.lua ### +Refrigerator = +## 1: Player name, 2: position +%s moves stuff in refrigerator at %s = +%s moves stuff to refrigerator at %s = +%s takes stuff from refrigerator at %s = +Not enough vertical space to place a refrigerator! = + +### television.lua ### +Small CRT Television = + +### signs_lib.lua ### +E: character map file not found = +## 1: Full String, 2: pos in string, 3: current char at pos +W: unknown symbol in '%s' at %d (probably %s) = diff --git a/locked.lua b/locked.lua index b960c77..77118cf 100644 --- a/locked.lua +++ b/locked.lua @@ -7,6 +7,15 @@ -- License: LGPL -- +-- Boilerplate to support localized strings if intllib mod is installed. +local S +if (minetest.get_modpath("intllib")) then + dofile(minetest.get_modpath("intllib").."/intllib.lua") + S = intllib.Getter(minetest.get_current_modname()) +else + S = function ( s ) return s end +end + --[[ | create_locked ( name, infotext ) | @@ -40,14 +49,12 @@ local function create_locked ( name, infotext ) end def.type = nil def.name = nil - local desc = "Locked "..def.description - def.description = desc + def.description = S("%s (Locked)"):format(def.description) local after_place_node = def.after_place_node def.after_place_node = function(pos, placer) local meta = minetest.env:get_meta(pos) meta:set_string("owner", placer:get_player_name() or "") - meta:set_string("infotext", (infotext or desc).." (owned by ".. - meta:get_string("owner")..")") + meta:set_string("infotext", S("%s (owned by %s)"):format(infotext,meta:get_string("owner"))) if (after_place_node) then return after_place_node(pos, placer) end @@ -56,10 +63,12 @@ local function create_locked ( name, infotext ) def.allow_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player) local meta = minetest.env:get_meta(pos) if (player:get_player_name() ~= meta:get_string("owner")) then - minetest.log("action", player:get_player_name().. - " tried to access a "..desc.." belonging to ".. - meta:get_string("owner").." at ".. - minetest.pos_to_string(pos)) + minetest.log("action", S("%s tried to access a %s belonging to %s at %s"):format( + player:get_player_name(), + infotext, + meta:get_string("owner"), + minetest.pos_to_string(pos) + )) return 0 end if (allow_metadata_inventory_move) then @@ -72,10 +81,12 @@ local function create_locked ( name, infotext ) def.allow_metadata_inventory_put = function(pos, listname, index, stack, player) local meta = minetest.env:get_meta(pos) if (player:get_player_name() ~= meta:get_string("owner")) then - minetest.log("action", player:get_player_name().. - " tried to access a "..desc.." belonging to ".. - meta:get_string("owner").." at ".. - minetest.pos_to_string(pos)) + minetest.log("action", S("%s tried to access a %s belonging to %s at %s"):format( + player:get_player_name(), + infotext, + meta:get_string("owner"), + minetest.pos_to_string(pos) + )) return 0 end if (allow_metadata_inventory_put) then @@ -88,10 +99,12 @@ local function create_locked ( name, infotext ) def.allow_metadata_inventory_take = function(pos, listname, index, stack, player) local meta = minetest.env:get_meta(pos) if (player:get_player_name() ~= meta:get_string("owner")) then - minetest.log("action", player:get_player_name().. - " tried to access a "..desc.." belonging to ".. - meta:get_string("owner").." at ".. - minetest.pos_to_string(pos)) + minetest.log("action", S("%s tried to access a %s belonging to %s at %s"):format( + player:get_player_name(), + infotext, + meta:get_string("owner"), + minetest.pos_to_string(pos) + )) return 0 end if (allow_metadata_inventory_take) then @@ -112,18 +125,27 @@ local function create_locked ( name, infotext ) end local items = { - { "refrigerator", "Fridge" }, - { "kitchen_cabinet", "Cabinet" }, - { "kitchen_cabinet_half", "Cabinet" }, - { "kitchen_cabinet_with_sink", "Cabinet" }, - { "nightstand_oak_one_drawer", "Nightstand" }, - { "nightstand_oak_two_drawers", "Nightstand" }, - { "nightstand_mahogany_one_drawer", "Nightstand" }, - { "nightstand_mahogany_two_drawers", "Nightstand" }, - { "oven", "Oven" }, + { "refrigerator", + "Cabinet" }, + { "kitchen_cabinet", + "Cabinet" }, + { "kitchen_cabinet_half", + "Cabinet" }, + { "kitchen_cabinet_with_sink", + "Cabinet" }, + { "nightstand_oak_one_drawer", + "Nightstand" }, + { "nightstand_oak_two_drawers", + "Nightstand" }, + { "nightstand_mahogany_one_drawer", + "Nightstand" }, + { "nightstand_mahogany_two_drawers", + "Nightstand" }, + { "oven", + "Oven" }, } for _,item in ipairs(items) do - local info = (item[2] and "Locked "..item[2]); - create_locked("homedecor:"..item[1], info); + local name, info = item[1], item[2]; + create_locked("homedecor:"..name, S("Locked "..info)); end diff --git a/nightstands.lua b/nightstands.lua index 0bedae6..f1369b2 100644 --- a/nightstands.lua +++ b/nightstands.lua @@ -1,8 +1,17 @@ -- This file supplies nightstands +-- Boilerplate to support localized strings if intllib mod is installed. +local S +if (minetest.get_modpath("intllib")) then + dofile(minetest.get_modpath("intllib").."/intllib.lua") + S = intllib.Getter(minetest.get_current_modname()) +else + S = function ( s ) return s end +end + minetest.register_node('homedecor:nightstand_oak_one_drawer', { drawtype = "nodebox", - description = "Oak Nightstand with One Drawer", + description = S("Oak Nightstand with One Drawer"), tiles = { 'homedecor_nightstand_oak_top.png', 'homedecor_nightstand_oak_bottom.png', 'homedecor_nightstand_oak_right.png', @@ -37,7 +46,7 @@ minetest.register_node('homedecor:nightstand_oak_one_drawer', { "size[8,6]".. "list[current_name;main;0,0;8,1;]".. "list[current_player;main;0,2;8,4;]") - meta:set_string("infotext", "One-drawer Nightstand") + meta:set_string("infotext", S("One-drawer Nightstand")) local inv = meta:get_inventory() inv:set_size("main", 8) end, @@ -47,22 +56,28 @@ minetest.register_node('homedecor:nightstand_oak_one_drawer', { return inv:is_empty("main") end, on_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player) - minetest.log("action", player:get_player_name().. - " moves stuff in nightstand at "..minetest.pos_to_string(pos)) + minetest.log("action", S("%s moves stuff in nightstand at %s"):format( + player:get_player_name(), + minetest.pos_to_string(pos) + )) end, on_metadata_inventory_put = function(pos, listname, index, stack, player) - minetest.log("action", player:get_player_name().. - " moves stuff to nightstand at "..minetest.pos_to_string(pos)) + minetest.log("action", S("%s moves stuff to nightstand at %s"):format( + player:get_player_name(), + minetest.pos_to_string(pos) + )) end, on_metadata_inventory_take = function(pos, listname, index, stack, player) - minetest.log("action", player:get_player_name().. - " takes stuff from nightstand at "..minetest.pos_to_string(pos)) + minetest.log("action", S("%s takes stuff from nightstand at %s"):format( + player:get_player_name(), + minetest.pos_to_string(pos) + )) end, }) minetest.register_node('homedecor:nightstand_oak_two_drawers', { drawtype = "nodebox", - description = "Oak Nightstand with One Drawer", + description = S("Oak Nightstand with Two Drawers"), tiles = { 'homedecor_nightstand_oak_top.png', 'homedecor_nightstand_oak_bottom.png', 'homedecor_nightstand_oak_right.png', @@ -94,7 +109,7 @@ minetest.register_node('homedecor:nightstand_oak_two_drawers', { "size[8,7]".. "list[current_name;main;0,0;8,2;]".. "list[current_player;main;0,3;8,4;]") - meta:set_string("infotext", "Two-drawer Nightstand") + meta:set_string("infotext", S("Two-drawer Nightstand")) local inv = meta:get_inventory() inv:set_size("main", 16) end, @@ -104,22 +119,28 @@ minetest.register_node('homedecor:nightstand_oak_two_drawers', { return inv:is_empty("main") end, on_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player) - minetest.log("action", player:get_player_name().. - " moves stuff in nightstand at "..minetest.pos_to_string(pos)) + minetest.log("action", S("%s moves stuff in nightstand at %s"):format( + player:get_player_name(), + minetest.pos_to_string(pos) + )) end, on_metadata_inventory_put = function(pos, listname, index, stack, player) - minetest.log("action", player:get_player_name().. - " moves stuff to nightstand at "..minetest.pos_to_string(pos)) + minetest.log("action", S("%s moves stuff to nightstand at %s"):format( + player:get_player_name(), + minetest.pos_to_string(pos) + )) end, on_metadata_inventory_take = function(pos, listname, index, stack, player) - minetest.log("action", player:get_player_name().. - " takes stuff from nightstand at "..minetest.pos_to_string(pos)) + minetest.log("action", S("%s takes stuff from nightstand at %s"):format( + player:get_player_name(), + minetest.pos_to_string(pos) + )) end, }) minetest.register_node('homedecor:nightstand_mahogany_one_drawer', { drawtype = "nodebox", - description = "Mahogany Nightstand with One Drawer", + description = S("Mahogany Nightstand with One Drawer"), tiles = { 'homedecor_nightstand_mahogany_top.png', 'homedecor_nightstand_mahogany_bottom.png', 'homedecor_nightstand_mahogany_right.png', @@ -154,7 +175,7 @@ minetest.register_node('homedecor:nightstand_mahogany_one_drawer', { "size[8,6]".. "list[current_name;main;0,0;8,1;]".. "list[current_player;main;0,2;8,4;]") - meta:set_string("infotext", "One-drawer Nightstand") + meta:set_string("infotext", S("One-drawer Nightstand")) local inv = meta:get_inventory() inv:set_size("main", 8) end, @@ -164,22 +185,28 @@ minetest.register_node('homedecor:nightstand_mahogany_one_drawer', { return inv:is_empty("main") end, on_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player) - minetest.log("action", player:get_player_name().. - " moves stuff in nightstand at "..minetest.pos_to_string(pos)) + minetest.log("action", S("%s moves stuff in nightstand at %s"):format( + player:get_player_name(), + minetest.pos_to_string(pos) + )) end, on_metadata_inventory_put = function(pos, listname, index, stack, player) - minetest.log("action", player:get_player_name().. - " moves stuff to nightstand at "..minetest.pos_to_string(pos)) + minetest.log("action", S("%s moves stuff to nightstand at %s"):format( + player:get_player_name(), + minetest.pos_to_string(pos) + )) end, on_metadata_inventory_take = function(pos, listname, index, stack, player) - minetest.log("action", player:get_player_name().. - " takes stuff from nightstand at "..minetest.pos_to_string(pos)) + minetest.log("action", S("%s takes stuff from nightstand at %s"):format( + player:get_player_name(), + minetest.pos_to_string(pos) + )) end, }) minetest.register_node('homedecor:nightstand_mahogany_two_drawers', { drawtype = "nodebox", - description = "Mahogany Nightstand with Two Drawers", + description = S("Mahogany Nightstand with Two Drawers"), tiles = { 'homedecor_nightstand_mahogany_top.png', 'homedecor_nightstand_mahogany_bottom.png', 'homedecor_nightstand_mahogany_right.png', @@ -211,7 +238,7 @@ minetest.register_node('homedecor:nightstand_mahogany_two_drawers', { "size[8,7]".. "list[current_name;main;0,0;8,2;]".. "list[current_player;main;0,3;8,4;]") - meta:set_string("infotext", "Two-drawer Nightstand") + meta:set_string("infotext", S("Two-drawer Nightstand")) local inv = meta:get_inventory() inv:set_size("main", 16) end, @@ -221,15 +248,21 @@ minetest.register_node('homedecor:nightstand_mahogany_two_drawers', { return inv:is_empty("main") end, on_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player) - minetest.log("action", player:get_player_name().. - " moves stuff in nightstand at "..minetest.pos_to_string(pos)) + minetest.log("action", S("%s moves stuff in nightstand at %s"):format( + player:get_player_name(), + minetest.pos_to_string(pos) + )) end, on_metadata_inventory_put = function(pos, listname, index, stack, player) - minetest.log("action", player:get_player_name().. - " moves stuff to nightstand at "..minetest.pos_to_string(pos)) + minetest.log("action", S("%s moves stuff to nightstand at %s"):format( + player:get_player_name(), + minetest.pos_to_string(pos) + )) end, on_metadata_inventory_take = function(pos, listname, index, stack, player) - minetest.log("action", player:get_player_name().. - " takes stuff from nightstand at "..minetest.pos_to_string(pos)) + minetest.log("action", S("%s takes stuff from nightstand at %s"):format( + player:get_player_name(), + minetest.pos_to_string(pos) + )) end, }) diff --git a/oven.lua b/oven.lua index 85ab9cd..0a1262d 100644 --- a/oven.lua +++ b/oven.lua @@ -1,5 +1,14 @@ -- This code supplies an oven/stove. Basically it's just a copy of the default furnace with different textures. +-- Boilerplate to support localized strings if intllib mod is installed. +local S +if (minetest.get_modpath("intllib")) then + dofile(minetest.get_modpath("intllib").."/intllib.lua") + S = intllib.Getter(minetest.get_current_modname()) +else + S = function ( s ) return s end +end + default.oven_inactive_formspec = "size[8,9]".. "image[2,2;1,1;default_furnace_fire_bg.png]".. @@ -9,7 +18,7 @@ default.oven_inactive_formspec = "list[current_player;main;0,5;8,4;]" minetest.register_node("homedecor:oven", { - description = "Oven", + description = S("Oven"), tiles = {"homedecor_oven_top.png", "homedecor_oven_bottom.png", "homedecor_oven_side.png", "homedecor_oven_side.png", "homedecor_oven_side.png", "homedecor_oven_front.png"}, paramtype2 = "facedir", @@ -40,7 +49,7 @@ minetest.register_node("homedecor:oven", { }) minetest.register_node("homedecor:oven_active", { - description = "Oven", + description = S("Oven"), tiles = {"homedecor_oven_top.png", "homedecor_oven_bottom.png", "homedecor_oven_side.png", "homedecor_oven_side.png", "homedecor_oven_side.png", "homedecor_oven_front_active.png"}, paramtype2 = "facedir", @@ -52,7 +61,7 @@ minetest.register_node("homedecor:oven_active", { on_construct = function(pos) local meta = minetest.env:get_meta(pos) meta:set_string("formspec", default.oven_inactive_formspec) - meta:set_string("infotext", "Oven"); + meta:set_string("infotext", S("Oven")) local inv = meta:get_inventory() inv:set_size("fuel", 1) inv:set_size("src", 1) @@ -128,7 +137,7 @@ minetest.register_abm({ srcstack:take_item() inv:set_stack("src", 1, srcstack) else - print("Could not insert '"..cooked.item:to_string().."'") + print(S("Could not insert '%s'"):format(cooked.item:to_string())) end meta:set_string("src_time", 0) end @@ -137,7 +146,7 @@ minetest.register_abm({ 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","Oven active: "..percent.."%") + meta:set_string("infotext",S("Oven active: %d%%"):format(percent)) hacky_swap_node(pos,"homedecor:oven_active") meta:set_string("formspec", "size[8,9]".. @@ -163,7 +172,7 @@ minetest.register_abm({ end if fuel.time <= 0 then - meta:set_string("infotext","Oven out of fuel") + meta:set_string("infotext",S("Oven out of fuel")) hacky_swap_node(pos,"homedecor:oven") meta:set_string("formspec", default.oven_inactive_formspec) return @@ -171,7 +180,7 @@ minetest.register_abm({ if cooked.item:is_empty() then if was_active then - meta:set_string("infotext","Oven is empty") + meta:set_string("infotext",S("Oven is empty")) hacky_swap_node(pos,"homedecor:oven") meta:set_string("formspec", default.oven_inactive_formspec) end diff --git a/refrigerator.lua b/refrigerator.lua index 7a32b41..1359357 100644 --- a/refrigerator.lua +++ b/refrigerator.lua @@ -1,22 +1,31 @@ -- This file supplies refrigerators +-- Boilerplate to support localized strings if intllib mod is installed. +local S +if (minetest.get_modpath("intllib")) then + dofile(minetest.get_modpath("intllib").."/intllib.lua") + S = intllib.Getter(minetest.get_current_modname()) +else + S = function ( s ) return s end +end + minetest.register_node('homedecor:refrigerator', { - drawtype = "nodebox", - description = "Refrigerator", - tiles = { - 'homedecor_refrigerator_top.png', - 'homedecor_refrigerator_bottom.png', - 'homedecor_refrigerator_right.png', - 'homedecor_refrigerator_left.png', - 'homedecor_refrigerator_back.png', - 'homedecor_refrigerator_front.png' - }, - inventory_image = "homedecor_refrigerator_inv.png", - sunlight_propagates = false, - paramtype = "light", - paramtype2 = "facedir", - walkable = true, - groups = { snappy = 3 }, + drawtype = "nodebox", + description = S("Refrigerator"), + tiles = { + 'homedecor_refrigerator_top.png', + 'homedecor_refrigerator_bottom.png', + 'homedecor_refrigerator_right.png', + 'homedecor_refrigerator_left.png', + 'homedecor_refrigerator_back.png', + 'homedecor_refrigerator_front.png' + }, + inventory_image = "homedecor_refrigerator_inv.png", + sunlight_propagates = false, + paramtype = "light", + paramtype2 = "facedir", + walkable = true, + groups = { snappy = 3 }, selection_box = { type = "fixed", @@ -27,43 +36,48 @@ minetest.register_node('homedecor:refrigerator', { fixed = { -0.5, -0.5, -0.5, 0.5, 1.5, 0.5 } }, - sounds = default.node_sound_leaves_defaults(), - on_construct = function(pos) - local meta = minetest.env:get_meta(pos) - meta:set_string("formspec", - "size[10,10]".. - "list[current_name;main;0,0;10,5;]".. - "list[current_player;main;1,6;8,4;]") - meta:set_string("infotext", "Refrigerator") - local inv = meta:get_inventory() - inv:set_size("main",50) - end, + sounds = default.node_sound_leaves_defaults(), + on_construct = function(pos) + local meta = minetest.env:get_meta(pos) + meta:set_string("formspec", + "size[10,10]".. + "list[current_name;main;0,0;10,5;]".. + "list[current_player;main;1,6;8,4;]") + meta:set_string("infotext", S("Refrigerator")) + local inv = meta:get_inventory() + inv:set_size("main",50) + end, - on_place = function(itemstack, placer, pointed_thing) - local pos = pointed_thing.above - if minetest.env:get_node({x=pos.x, y=pos.y+1, z=pos.z}).name ~= "air" then - minetest.chat_send_player( placer:get_player_name(), 'Not enough vertical space to place a refrigerator!' ) - return - end - return minetest.item_place(itemstack, placer, pointed_thing) - end, + on_place = function(itemstack, placer, pointed_thing) + local pos = pointed_thing.above + if minetest.env:get_node({x=pos.x, y=pos.y+1, z=pos.z}).name ~= "air" then + minetest.chat_send_player( placer:get_player_name(), S('Not enough vertical space to place a refrigerator!') ) + return + end + return minetest.item_place(itemstack, placer, pointed_thing) + end, - can_dig = function(pos,player) - local meta = minetest.env:get_meta(pos); - local inv = meta:get_inventory() - return inv:is_empty("main") - end, - on_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player) - minetest.log("action", player:get_player_name().. - " moves stuff in refrigerator at "..minetest.pos_to_string(pos)) - end, + can_dig = function(pos,player) + local meta = minetest.env:get_meta(pos); + local inv = meta:get_inventory() + return inv:is_empty("main") + end, + on_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player) + minetest.log("action", S("%s moves stuff in refrigerator at %s"):format( + player:get_player_name(), + minetest.pos_to_string(pos) + )) + end, on_metadata_inventory_put = function(pos, listname, index, stack, player) - minetest.log("action", player:get_player_name().. - " moves stuff to refrigerator at "..minetest.pos_to_string(pos)) - end, + minetest.log("action", S("%s moves stuff to refrigerator at %s"):format( + player:get_player_name(), + minetest.pos_to_string(pos) + )) + end, on_metadata_inventory_take = function(pos, listname, index, stack, player) - minetest.log("action", player:get_player_name().. - " takes stuff from refrigerator at "..minetest.pos_to_string(pos)) - end, + minetest.log("action", S("%s takes stuff from refrigerator at %s"):format( + player:get_player_name(), + minetest.pos_to_string(pos) + )) + end, }) - diff --git a/signs_lib.lua b/signs_lib.lua index 873df96..be70c7f 100644 --- a/signs_lib.lua +++ b/signs_lib.lua @@ -2,12 +2,21 @@ -- Font: 04.jp.org +-- Boilerplate to support localized strings if intllib mod is installed. +local S +if (minetest.get_modpath("intllib")) then + dofile(minetest.get_modpath("intllib").."/intllib.lua") + S = intllib.Getter(minetest.get_current_modname()) +else + S = function ( s ) return s end +end + -- load characters map local chars_file = io.open(minetest.get_modpath("homedecor").."/characters", "r") local charmap = {} local max_chars = 16 if not chars_file then - print("[homedecor] E: character map file not found") + print("[homedecor] "..S("E: character map file not found")) else while true do local char = chars_file:read("*l") @@ -169,7 +178,7 @@ homedecor_generate_line = function(s, ypos) file = charmap[s:sub(i, i + 1)] i = i + 2 else - print("[homedecor] W: unknown symbol in '"..s.."' at "..i.." (probably "..s:sub(i, i)..")") + print("[homedecor] "..S("W: unknown symbol in '%s' at %d (probably %s)"):format(s, i, s:sub(i, i))) i = i + 1 end if file ~= nil then diff --git a/television.lua b/television.lua index 783bd7b..8200337 100644 --- a/television.lua +++ b/television.lua @@ -1,7 +1,16 @@ -- This file provides a semi-animated television. +-- Boilerplate to support localized strings if intllib mod is installed. +local S +if (minetest.get_modpath("intllib")) then + dofile(minetest.get_modpath("intllib").."/intllib.lua") + S = intllib.Getter(minetest.get_current_modname()) +else + S = function ( s ) return s end +end + minetest.register_node('homedecor:television', { - description = "Small CRT Television", + description = S("Small CRT Television"), tiles = { 'homedecor_television_top.png', 'homedecor_television_bottom.png', 'homedecor_television_right.png',