diff --git a/README.md b/README.md index 187df11..3c08ac5 100644 --- a/README.md +++ b/README.md @@ -11,3 +11,6 @@ ##### Thanks to all contributors that keep this mod alive. ##### ![Preview](http://i.imgur.com/AVoyCQy.png) + +### Requirements ### +This mod requires at least version 5.0.0 of minetest. diff --git a/depends.txt b/depends.txt deleted file mode 100644 index c582a68..0000000 --- a/depends.txt +++ /dev/null @@ -1,10 +0,0 @@ -default -bucket -doors -farming -stairs -xpanes -fire? -oresplus? -moreblocks? -mesecons? diff --git a/description.txt b/description.txt deleted file mode 100644 index d338743..0000000 --- a/description.txt +++ /dev/null @@ -1 +0,0 @@ -A decoration mod meant to be simple and well-featured. diff --git a/locale/template.txt b/locale/template.txt new file mode 100644 index 0000000..17e37b4 --- /dev/null +++ b/locale/template.txt @@ -0,0 +1,154 @@ +# textdomain: xdecor + + +### chess.lua ### + +Black Bishop= +Black King= +Black Knight= +Black Pawn= +Black Queen= +Black Rook= +Chess= +Chess Board= +Dumb AI= +Multiplayer= +New game= +Select a mode:= +Singleplayer= +Someone else plays black pieces!= +Someone else plays white pieces!= +White Bishop= +White King= +White Knight= +White Pawn= +White Queen= +White Rook= + +You can't dig the chessboard, a game has been started. Reset it first if you're a current player, or dig it again in @1= + +You can't reset the chessboard, a game has been started. If you aren't a current player, try again in @1= + +check= + +### cooking.lua ### + +Bowl= +Bowl of soup= +Cauldron= +Cauldron (active) - Drop foods inside to make a soup= +Cauldron (active) - Use a bowl to eat the soup= +Cauldron (empty)= +Cauldron (idle)= +No room in your inventory to add a bowl of soup.= +No room in your inventory to add a bucket of water.= + +### enchanting.lua ### + +Axe= +Bronze= +Diamond= +Durability= +Efficiency= +Enchanted @1 @2 @3= +Enchantment Table= +Mese= +Pickaxe= +Sharpness= +Shovel= +Steel= +Sword= +Your tool digs faster= +Your tool last longer= +Your weapon inflicts more damages= + +### hive.lua ### + +Artificial Hive= +Bees are busy making honey…= +Honey= + +### itemframe.lua ### + +@1 (owned by @2)= +Item Frame= + +### mailbox.lua ### + +@1's Mailbox= +Last donators= +Mailbox= +Send your goods to@n@1= +The mailbox is full.= + +### mechanisms.lua ### + +Lever= +Stone Pressure Plate= +Wooden Pressure Plate= + +### nodes.lua ### + +Bamboo Frame= +Baricade= +Barrel= +Cactus Brick= +Candle= +Chainlink= +Chair= +Coal Stone Tile= +Cobweb= +Cushion= +Cushion Block= +Desert Stone Tile= +Empty Shelf= +Ender Chest= +Garden Stone Path= +Half Wooden Cabinet= +Hardened Clay= +Iron Light Box= +Ivy= +Japanese Door= +Lantern= +Moon Brick= +Multi Shelf= +Packed Ice= +Painting= +Potted Geranium= +Potted Rose= +Potted Tulip= +Potted Viola= +Potted White Dandelion= +Potted Yellow Dandelion= +Prison Door= +Red Curtain= +Runestone= +Rusty Iron Bars= +Rusty Prison Door= +Screen Door= +Slide Door= +Stone Tile= +Table= +Tatami= +Television= +Trampoline= +Wood Frame= +Wood Framed Glass= +Wooden Cabinet= +Wooden Light Box= +Wooden Tile= +Woodglass Door= + +### rope.lua ### + +Rope= + +### workbench.lua ### + +Back= +Crafting= +Cut= +Hammer= +Repair= +Storage= +Work Bench= diff --git a/locale/xdecor.fr.tr b/locale/xdecor.fr.tr new file mode 100644 index 0000000..51b3eea --- /dev/null +++ b/locale/xdecor.fr.tr @@ -0,0 +1,154 @@ +# textdomain: xdecor + + +### chess.lua ### + +Black Bishop=Fou noir +Black King=Roi noir +Black Knight=Cavalier noir +Black Pawn=Pion noir +Black Queen=Reine noire +Black Rook=Tour noire +Chess=Echecs +Chess Board=Echiquier +Dumb AI=IA stupide +Multiplayer=Multijoueur +New game=Nouvelle partie +Select a mode:=Sélectionnez un mode de jeu: +Singleplayer=Solo +Someone else plays black pieces!=Quelqu’un d’autre joue les pièces noires ! +Someone else plays white pieces!=Quelqu’un d’autre joue les pièces blanches ! +White Bishop=Fou blanc +White King=Roi blanc +White Knight=Cavalier blanc +White Pawn=Pion blanc +White Queen=Reine blanche +White Rook=Tour blanche + +You can't dig the chessboard, a game has been started. Reset it first if you're a current player, or dig it again in @1=Vous ne pouvez pas récupérer l’échiquier, une partie à été commencée. Remettez le à zéro si vous c’est votre tour de jouer, ou réessayez dans @1 + +You can't reset the chessboard, a game has been started. If you aren't a current player, try again in @1=Vous ne pouvez pas mettre à zéro l’échiquier, une partie a été commencée. Si ce n’est pas votre tour de jouer, réessayez dans @1 + +check=échec + +### cooking.lua ### + +Bowl=Bol +Bowl of soup=Bol de soupe +Cauldron=Chaudron +Cauldron (active) - Drop foods inside to make a soup=Chaudron (actif) - Placez des ingrédients à l’intérieur pour faire une soupe +Cauldron (active) - Use a bowl to eat the soup=Chaudron (actif) - Utilisez un bol pour boire la soupe +Cauldron (empty)=Chaudron (vide) +Cauldron (idle)=Chaudron (inactif) +No room in your inventory to add a bowl of soup.=Pas de place dans votre inventaire pour ajouter un bol de soupe. +No room in your inventory to add a bucket of water.=Pas de place dans votre inventaire pour ajouter un seau d’eau. + +### enchanting.lua ### + +Axe=Hache +Bronze=Bronze +Diamond=Diamant +Durability=Durabilité +Efficiency=Efficacité +Enchanted @1 @2 @3=@2 en @1 enchantée @3 +Enchantment Table=Table d’enchantements +Mese=Mese +Pickaxe=Pioche +Sharpness=Tranchant +Shovel=Pelle +Steel=Fer +Sword=Épée +Your tool digs faster=Votre outil creuse plus vite +Your tool last longer=Votre outil dure plus longtemps +Your weapon inflicts more damages=Votre arme inflige plus de dégâts + +### hive.lua ### + +Artificial Hive=Ruche artificielle +Bees are busy making honey…=Les abeilles sont occupées à fabriquer du miel… +Honey=Miel + +### itemframe.lua ### + +@1 (owned by @2)=@1 (propriété de @2) +Item Frame=Cadre + +### mailbox.lua ### + +@1's Mailbox=Boite aux lettres de @1 +Last donators=Derniers donateurs +Mailbox=Boite aux lettres +Send your goods to@n@1=Envoyer vos biens à@n@1 +The mailbox is full.=La boite aux lettres est pleine. + +### mechanisms.lua ### + +Lever=Levier +Stone Pressure Plate=Plaque de pression en pierre +Wooden Pressure Plate=Plaque de pression en bois + +### nodes.lua ### + +Bamboo Frame=Cadre en bambou +Baricade=Barricade +Barrel=Tonneau +Cactus Brick=Brique en cactus +Candle=Bougie +Chainlink=Maillon de chaîne +Chair=Chaise +Coal Stone Tile=Carreau en charbon et pierre +Cobweb=Toile d’araignée +Cushion=Coussin +Cushion Block=Bloc de coussin +Desert Stone Tile=Carreau en pierre du désert +Empty Shelf=Étagère vide +Ender Chest=Coffre de l’End +Garden Stone Path=Chemin de pierres de jardin +Half Wooden Cabinet=Demi meuble en bois +Hardened Clay=Argile durcie +Iron Light Box=Boite lumineuse en fer +Ivy=Lierre +Japanese Door=Porte japonaise +Lantern=Lanterne +Moon Brick=Brique lunaire +Multi Shelf=Étagères multiple +Packed Ice=Glace compactée +Painting=Tableau +Potted Geranium=Géranium en pot +Potted Rose=Rose en pot +Potted Tulip=Tulipe en pot +Potted Viola=Violette en pot +Potted White Dandelion=Pissenlit blanc en pot +Potted Yellow Dandelion=Pissenlit jaune en pot +Prison Door=Porte de prison +Red Curtain=Rideaux rouge +Runestone=Pierre runique +Rusty Iron Bars=Barreaux en fer rouillé +Rusty Prison Door=Barreaux de prison rouillés +Screen Door=Porte avec moustiquaire +Slide Door=Porte coulissante +Stone Tile=Carreau en pierre +Table=Table +Tatami=Tatami +Television=Télévision +Trampoline=Trampoline +Wood Frame=Cadre en bois +Wood Framed Glass=Verre encadré par du bois +Wooden Cabinet=Meuble en bois +Wooden Light Box=Boite lumineuse en bois +Wooden Tile=Carreau en bois +Woodglass Door=Porte vitrée + +### rope.lua ### + +Rope=Corde + +### workbench.lua ### + +Back=Retour +Crafting=Fabrication +Cut=Couper +Hammer=Marteau +Repair=Réparer +Storage=Stockage +Work Bench=Atelier diff --git a/mod.conf b/mod.conf index 3f843bc..0d492e0 100644 --- a/mod.conf +++ b/mod.conf @@ -1,4 +1,5 @@ name = xdecor +description = A decoration mod meant to be simple and well-featured. depends = default, bucket, doors, farming, stairs, xpanes optional_depends = fire, oresplus, moreblocks, mesecons -description = A decoration mod meant to be simple and well-featured. +min_minetest_version = 5.0.0 diff --git a/src/chess.lua b/src/chess.lua index 4529955..515e31b 100644 --- a/src/chess.lua +++ b/src/chess.lua @@ -1,4 +1,6 @@ local realchess = {} +local S = minetest.get_translator("xdecor") +local FS = function(...) return minetest.formspec_escape(S(...)) end screwdriver = screwdriver or {} local function index_to_xy(idx) @@ -22,7 +24,7 @@ local function get_square(a, b) return (a * 8) - (8 - b) end -local chat_prefix = minetest.colorize("#FFFF00", "[Chess] ") +local chat_prefix = minetest.colorize("#FFFF00", "["..S("Chess").."] ") local letters = {'A','B','C','D','E','F','G','H'} local function board_to_table(inv) @@ -588,10 +590,10 @@ pieces_str = pieces_str .. "69=mailbox_blank16.png" local fs_init = [[ size[4,1.2;] no_prepend[] - label[0,0;Select a mode:] - button[0,0.5;2,1;single;Singleplayer] - button[2,0.5;2,1;multi;Multiplayer] -]] + ]] + .."label[0,0;"..FS("Select a mode:").."]" + .."button[0,0.5;2,1;single;"..FS("Singleplayer").."]" + .."button[2,0.5;2,1;multi;"..FS("Multiplayer").."]" local fs = [[ size[14.7,10;] @@ -601,8 +603,9 @@ local fs = [[ list[context;board;0.3,1;8,8;] listcolors[#00000000;#00000000;#00000000;#30434C;#FFF] tableoptions[background=#00000000;highlight=#00000000;border=false] - button[10.5,8.5;2,2;new;New game] -]] .. "tablecolumns[image," .. pieces_str .. + ]] + .."button[10.5,8.5;2,2;new;"..FS("New game").."]" + .."tablecolumns[image," .. pieces_str .. ";text;color;text;color;text;image," .. pieces_str .. "]" local function update_formspec(meta) @@ -619,7 +622,7 @@ local function update_formspec(meta) playerBlack .. "..." or playerBlack) local turnWhite = minetest.colorize("#000001", (lastMove == "black" and playerWhite ~= "") and playerWhite .. "..." or playerWhite) - local check_s = minetest.colorize("#FF0000", "\\[check\\]") + local check_s = minetest.colorize("#FF0000", "\\["..FS("check").."\\]") local formspec = fs .. "label[1.9,0.3;" .. turnBlack .. (black_king_attacked and " " .. check_s or "") .. "]" .. @@ -687,7 +690,7 @@ function realchess.init(pos) local inv = meta:get_inventory() meta:set_string("formspec", fs_init) - meta:set_string("infotext", "Chess Board") + meta:set_string("infotext", S("Chess Board")) meta:set_string("playerBlack", "") meta:set_string("playerWhite", "") meta:set_string("lastMove", "") @@ -725,7 +728,7 @@ function realchess.move(pos, from_list, from_index, to_list, to_index, _, player if pieceFrom:find("white") then if playerWhite ~= "" and playerWhite ~= playerName then - minetest.chat_send_player(playerName, chat_prefix .. "Someone else plays white pieces!") + minetest.chat_send_player(playerName, chat_prefix .. S("Someone else plays white pieces!")) return 0 end @@ -743,7 +746,7 @@ function realchess.move(pos, from_list, from_index, to_list, to_index, _, player elseif pieceFrom:find("black") then if playerBlack ~= "" and playerBlack ~= playerName then - minetest.chat_send_player(playerName, chat_prefix .. "Someone else plays black pieces!") + minetest.chat_send_player(playerName, chat_prefix .. S("Someone else plays black pieces!")) return 0 end @@ -1329,7 +1332,7 @@ local function ai_move(inv, meta) end if meta:get_string("playerBlack") == "" then - meta:set_string("playerBlack", "Dumb AI") + meta:set_string("playerBlack", S("Dumb AI")) end meta:set_string("lastMove", "black") @@ -1396,9 +1399,9 @@ function realchess.fields(pos, _, fields, sender) realchess.init(pos) else minetest.chat_send_player(playerName, chat_prefix .. - "You can't reset the chessboard, a game has been started. " .. - "If you aren't a current player, try again in " .. - timeout_format(timeout_limit)) + S("You can't reset the chessboard, a game has been started. " .. + "If you aren't a current player, try again in @1", + timeout_format(timeout_limit))) end end end @@ -1417,13 +1420,13 @@ function realchess.dig(pos, player) -- Timeout is 5 min. by default for digging the chessboard (non-players only) return (lastMoveTime == 0 and minetest.get_gametime() > timeout_limit) or minetest.chat_send_player(playerName, chat_prefix .. - "You can't dig the chessboard, a game has been started. " .. - "Reset it first if you're a current player, or dig it again in " .. - timeout_format(timeout_limit)) + S("You can't dig the chessboard, a game has been started. " .. + "Reset it first if you're a current player, or dig it again in @1", + timeout_format(timeout_limit))) end minetest.register_node(":realchess:chessboard", { - description = "Chess Board", + description = S("Chess Board"), drawtype = "nodebox", paramtype = "light", paramtype2 = "facedir", @@ -1443,11 +1446,11 @@ minetest.register_node(":realchess:chessboard", { allow_metadata_inventory_take = function() return 0 end }) -local function register_piece(name, count) +local function register_piece(name, white_desc, black_desc, count) for _, color in pairs({"black", "white"}) do if not count then minetest.register_craftitem(":realchess:" .. name .. "_" .. color, { - description = color:gsub("^%l", string.upper) .. " " .. name:gsub("^%l", string.upper), + description = (color == "black") and black_desc or white_desc, inventory_image = name .. "_" .. color .. ".png", stack_max = 1, groups = {not_in_creative_inventory=1} @@ -1455,7 +1458,7 @@ local function register_piece(name, count) else for i = 1, count do minetest.register_craftitem(":realchess:" .. name .. "_" .. color .. "_" .. i, { - description = color:gsub("^%l", string.upper) .. " " .. name:gsub("^%l", string.upper), + description = (color == "black") and black_desc or white_desc, inventory_image = name .. "_" .. color .. ".png", stack_max = 1, groups = {not_in_creative_inventory=1} @@ -1465,12 +1468,12 @@ local function register_piece(name, count) end end -register_piece("pawn", 8) -register_piece("rook", 2) -register_piece("knight", 2) -register_piece("bishop", 2) -register_piece("queen") -register_piece("king") +register_piece("pawn", S("White Pawn"), S("Black Pawn"), 8) +register_piece("rook", S("White Rook"), S("Black Rook"), 2) +register_piece("knight", S("White Knight"), S("Black Knight"), 2) +register_piece("bishop", S("White Bishop"), S("Black Bishop"), 2) +register_piece("queen", S("White Queen"), S("Black Queen")) +register_piece("king", S("White King"), S("Black King")) -- Recipes diff --git a/src/cooking.lua b/src/cooking.lua index ec5d11e..fb0699e 100644 --- a/src/cooking.lua +++ b/src/cooking.lua @@ -1,4 +1,5 @@ local cauldron, sounds = {}, {} +local S = minetest.get_translator("xdecor") -- Add more ingredients here that make a soup. local ingredients_list = { @@ -38,7 +39,7 @@ function cauldron.boiling_construct(pos) }) local meta = minetest.get_meta(pos) - meta:set_string("infotext", "Cauldron (active) - Drop some foods inside to make a soup") + meta:set_string("infotext", S("Cauldron (active) - Drop foods inside to make a soup")) local timer = minetest.get_node_timer(pos) timer:start(5.0) @@ -56,7 +57,7 @@ function cauldron.filling(pos, node, clicker, itemstack) inv:add_item("main", "bucket:bucket_water 1") else minetest.chat_send_player(clicker:get_player_name(), - "No room in your inventory to add a bucket of water.") + S("No room in your inventory to add a bucket of water.")) return itemstack end else @@ -145,7 +146,7 @@ function cauldron.take_soup(pos, node, clicker, itemstack) inv:add_item("main", "xdecor:bowl_soup 1") else minetest.chat_send_player(clicker:get_player_name(), - "No room in your inventory to add a bowl of soup.") + S("No room in your inventory to add a bowl of soup.")) return itemstack end else @@ -159,11 +160,11 @@ function cauldron.take_soup(pos, node, clicker, itemstack) end xdecor.register("cauldron_empty", { - description = "Cauldron", + description = S("Cauldron"), groups = {cracky=2, oddly_breakable_by_hand=1}, on_rotate = screwdriver.rotate_simple, tiles = {"xdecor_cauldron_top_empty.png", "xdecor_cauldron_sides.png"}, - infotext = "Cauldron (empty)", + infotext = S("Cauldron (empty)"), collision_box = xdecor.pixelbox(16, cauldron.cbox), on_rightclick = cauldron.filling, on_construct = function(pos) @@ -176,7 +177,7 @@ xdecor.register("cauldron_idle", { on_rotate = screwdriver.rotate_simple, tiles = {"xdecor_cauldron_top_idle.png", "xdecor_cauldron_sides.png"}, drop = "xdecor:cauldron_empty", - infotext = "Cauldron (idle)", + infotext = S("Cauldron (idle)"), collision_box = xdecor.pixelbox(16, cauldron.cbox), on_rightclick = cauldron.filling, on_construct = cauldron.idle_construct, @@ -187,7 +188,7 @@ xdecor.register("cauldron_boiling", { groups = {cracky=2, oddly_breakable_by_hand=1, not_in_creative_inventory=1}, on_rotate = screwdriver.rotate_simple, drop = "xdecor:cauldron_empty", - infotext = "Cauldron (active) - Drop foods inside to make a soup", + infotext = S("Cauldron (active) - Drop foods inside to make a soup"), damage_per_second = 2, tiles = { { @@ -209,7 +210,7 @@ xdecor.register("cauldron_soup", { groups = {cracky = 2, oddly_breakable_by_hand = 1, not_in_creative_inventory = 1}, on_rotate = screwdriver.rotate_simple, drop = "xdecor:cauldron_empty", - infotext = "Cauldron (active) - Use a bowl to eat the soup", + infotext = S("Cauldron (active) - Use a bowl to eat the soup"), damage_per_second = 2, tiles = { { @@ -228,14 +229,14 @@ xdecor.register("cauldron_soup", { -- Craft items minetest.register_craftitem("xdecor:bowl", { - description = "Bowl", + description = S("Bowl"), inventory_image = "xdecor_bowl.png", wield_image = "xdecor_bowl.png", groups = {food_bowl = 1, flammable = 2}, }) minetest.register_craftitem("xdecor:bowl_soup", { - description = "Bowl of soup", + description = S("Bowl of soup"), inventory_image = "xdecor_bowl_soup.png", wield_image = "xdecor_bowl_soup.png", groups = {not_in_creative_inventory=1}, diff --git a/src/enchanting.lua b/src/enchanting.lua index aa0b301..34f6077 100644 --- a/src/enchanting.lua +++ b/src/enchanting.lua @@ -1,4 +1,6 @@ screwdriver = screwdriver or {} +local S = minetest.get_translator("xdecor") +local FS = function(...) return minetest.formspec_escape(S(...)) end local ceil, abs, random = math.ceil, math.abs, math.random local reg_tools = minetest.registered_tools @@ -12,8 +14,8 @@ local enchanting = { damages = 1, -- Sharpness } -local function cap(S) return - S:gsub("^%l", string.upper) +local function cap(str) return + str:gsub("^%l", string.upper) end local function to_percent(orig_value, final_value) @@ -44,15 +46,21 @@ function enchanting:get_tooltip(enchant, orig_caps, fleshy) sharp = {"#ffff00", " (+" .. bonus.damages .. "%)"}, } + local enchant_loc = { + fast = S("Efficiency"), + durable = S("Durability"), + sharp = S("Sharpness"), + } + return minetest.colorize and minetest.colorize(specs[enchant][1], - "\n" .. cap(enchant) .. specs[enchant][2]) or - "\n" .. cap(enchant) .. specs[enchant][2] + "\n" .. enchant_loc[enchant] .. specs[enchant][2]) or + "\n" .. enchant_loc[enchant] .. specs[enchant][2] end local enchant_buttons = { - "image_button[3.9,0.85;4,0.92;bg_btn.png;fast;Efficiency]" .. - "image_button[3.9,1.77;4,1.12;bg_btn.png;durable;Durability]", - "image_button[3.9,2.9;4,0.92;bg_btn.png;sharp;Sharpness]", + "image_button[3.9,0.85;4,0.92;bg_btn.png;fast;"..FS("Efficiency").."]" .. + "image_button[3.9,1.77;4,1.12;bg_btn.png;durable;"..FS("Durability").."]", + "image_button[3.9,2.9;4,0.92;bg_btn.png;sharp;"..FS("Sharpness").."]", } function enchanting.formspec(pos, num) @@ -68,10 +76,11 @@ function enchanting.formspec(pos, num) listring[current_player;main] listring[context;mese] image[2,2.9;1,1;mese_layout.png] - tooltip[sharp;Your weapon inflicts more damages] - tooltip[durable;Your tool last longer] - tooltip[fast;Your tool digs faster] ]] .. - default.gui_slots .. default.get_hotbar_bg(0.5,4.5) + ]] + .."tooltip[sharp;"..FS("Your weapon inflicts more damages").."]" + .."tooltip[durable;"..FS("Your tool last longer").."]" + .."tooltip[fast;"..FS("Your tool digs faster").."]" + ..default.gui_slots .. default.get_hotbar_bg(0.5,4.5) formspec = formspec .. (enchant_buttons[num] or "") meta:set_string("formspec", formspec) @@ -150,7 +159,7 @@ end function enchanting.construct(pos) local meta = minetest.get_meta(pos) - meta:set_string("infotext", "Enchantment Table") + meta:set_string("infotext", S("Enchantment Table")) enchanting.formspec(pos) local inv = meta:get_inventory() @@ -207,7 +216,7 @@ function enchanting.timer(pos) end xdecor.register("enchantment_table", { - description = "Enchantment Table", + description = S("Enchantment Table"), tiles = { "xdecor_enchantment_top.png", "xdecor_enchantment_bottom.png", "xdecor_enchantment_side.png", "xdecor_enchantment_side.png", @@ -275,8 +284,9 @@ function enchanting:register_tools(mod, def) end minetest.register_tool(":" .. mod .. ":enchanted_" .. tool .. "_" .. material .. "_" .. enchant, { - description = "Enchanted " .. cap(material) .. " " .. cap(tool) .. - self:get_tooltip(enchant, original_groupcaps[group], fleshy), + description = S("Enchanted @1 @2 @3", + def.material_desc[material] or cap(material), def.tools[tool].desc or cap(tool), + self:get_tooltip(enchant, original_groupcaps[group], fleshy)), inventory_image = original_tool.inventory_image .. "^[colorize:violet:50", wield_image = original_tool.wield_image, groups = {not_in_creative_inventory = 1}, @@ -294,12 +304,13 @@ end enchanting:register_tools("default", { materials = "steel, bronze, mese, diamond", + material_desc = {steel = S("Steel"), bronze = S("Bronze"), mese = S("Mese"), diamond = S("Diamond")}, tools = { - axe = {enchants = "durable, fast"}, - pick = {enchants = "durable, fast"}, - shovel = {enchants = "durable, fast"}, - sword = {enchants = "sharp"} - } + axe = {enchants = "durable, fast", desc = S("Axe")}, + pick = {enchants = "durable, fast", desc = S("Pickaxe")}, + shovel = {enchants = "durable, fast", desc = S("Shovel")}, + sword = {enchants = "sharp", desc = S("Sword")} + }, }) -- Recipes diff --git a/src/hive.lua b/src/hive.lua index a90d12e..2aa9910 100644 --- a/src/hive.lua +++ b/src/hive.lua @@ -1,22 +1,24 @@ local hive = {} +local S = minetest.get_translator("xdecor") +local FS = function(...) return minetest.formspec_escape(S(...)) end local honey_max = 16 function hive.construct(pos) local meta = minetest.get_meta(pos) local inv = meta:get_inventory() - local formspec = [[ size[8,5;] - label[0.5,0;Bees are busy making honey...] - image[6,0;1,1;hive_bee.png] - image[5,0;1,1;hive_layout.png] - list[context;honey;5,0;1,1;] - list[current_player;main;0,1.35;8,4;] + local formspec = "size[8,6;]" + .."label[0.5,0;"..FS("Bees are busy making honey…").."]" + ..[[ image[6,1;1,1;hive_bee.png] + image[5,1;1,1;hive_layout.png] + list[context;honey;5,1;1,1;] + list[current_player;main;0,2.35;8,4;] listring[current_player;main] listring[context;honey] ]] .. - xbg .. default.get_hotbar_bg(0,1.35) + xbg .. default.get_hotbar_bg(0,2.35) meta:set_string("formspec", formspec) - meta:set_string("infotext", "Artificial Hive") + meta:set_string("infotext", S("Artificial Hive")) inv:set_size("honey", 1) local timer = minetest.get_node_timer(pos) @@ -50,7 +52,7 @@ function hive.timer(pos) end xdecor.register("hive", { - description = "Artificial Hive", + description = S("Artificial Hive"), tiles = {"xdecor_hive_top.png", "xdecor_hive_top.png", "xdecor_hive_side.png", "xdecor_hive_side.png", "xdecor_hive_side.png", "xdecor_hive_front.png"}, @@ -82,7 +84,7 @@ xdecor.register("hive", { -- Craft items minetest.register_craftitem("xdecor:honey", { - description = "Honey", + description = S("Honey"), inventory_image = "xdecor_honey.png", wield_image = "xdecor_honey.png", on_use = minetest.item_eat(2), diff --git a/src/itemframe.lua b/src/itemframe.lua index a79d56e..38dcc0a 100644 --- a/src/itemframe.lua +++ b/src/itemframe.lua @@ -1,4 +1,5 @@ local itemframe, tmp = {}, {} +local S = minetest.get_translator("xdecor") screwdriver = screwdriver or {} local function remove_item(pos, node) @@ -56,7 +57,7 @@ function itemframe.after_place(pos, placer, itemstack) local meta = minetest.get_meta(pos) local name = placer:get_player_name() meta:set_string("owner", name) - meta:set_string("infotext", "Item Frame (owned by " .. name .. ")") + meta:set_string("infotext", S("@1 (owned by @2)", S("Item Frame"), name)) end function itemframe.timer(pos) @@ -86,9 +87,9 @@ function itemframe.rightclick(pos, node, clicker, itemstack) meta:set_string("item", itemstring) update_item(pos, node) if itemstring == "" then - meta:set_string("infotext", "Item Frame (owned by " .. owner .. ")") + meta:set_string("infotext", S("@1 (owned by @2)", S("Item Frame"), owner)) else - meta:set_string("infotext", itemstring.." (owned by " .. owner .. ")") + meta:set_string("infotext", S("@1 (owned by @2)", itemstring, owner)) end return itemstack end @@ -115,7 +116,7 @@ function itemframe.dig(pos, player) end xdecor.register("itemframe", { - description = "Item Frame", + description = S("Item Frame"), groups = {choppy = 3, oddly_breakable_by_hand = 2, flammable = 3}, sounds = default.node_sound_wood_defaults(), on_rotate = screwdriver.disallow, @@ -182,4 +183,4 @@ minetest.register_craft({ {"group:stick", "default:paper", "group:stick"}, {"group:stick", "group:stick", "group:stick"} } -}) \ No newline at end of file +}) diff --git a/src/mailbox.lua b/src/mailbox.lua index a3f5424..78a3ed3 100644 --- a/src/mailbox.lua +++ b/src/mailbox.lua @@ -1,5 +1,7 @@ local mailbox = {} screwdriver = screwdriver or {} +local S = minetest.get_translator("xdecor") +local FS = function(...) return minetest.formspec_escape(S(...)) end local function get_img(img) if not img then return end @@ -61,10 +63,10 @@ function mailbox:formspec(pos, owner, is_owner) end end - return [[ size[9.5,9] - label[0,0;Mailbox] - label[6,0;Last donators] - box[6,0.72;3.3,3.5;#555555] + return "size[9.5,9]" + .."label[0,0;"..FS("Mailbox").."]" + .."label[6,0;"..FS("Last donators").."]" + ..[[ box[6,0.72;3.3,3.5;#555555] listring[current_player;main] list[current_player;main;0.75,5.25;8,4;] tableoptions[background=#00000000;highlight=#00000000;border=false] ]] .. @@ -77,9 +79,9 @@ function mailbox:formspec(pos, owner, is_owner) return "size[8,5]" .. "list[current_player;main;0,1.25;8,4;]" .. - "label[0,0;Send your goods to\n" .. + "label[0,0;"..FS("Send your goods to\n@1", (minetest.colorize and - minetest.colorize("#FFFF00", owner) or owner) .. "]" .. + minetest.colorize("#FFFF00", owner) or owner)) .. "]" .. "list[nodemeta:" .. spos .. ";drop;3.5,0;1,1;]" .. xbg .. default.get_hotbar_bg(0, 1.25) end @@ -98,7 +100,7 @@ function mailbox.after_place_node(pos, placer) local player_name = placer:get_player_name() meta:set_string("owner", player_name) - meta:set_string("infotext", player_name .. "'s Mailbox") + meta:set_string("infotext", S("@1's Mailbox", player_name)) local inv = meta:get_inventory() inv:set_size("mailbox", 6 * 4) @@ -123,7 +125,7 @@ function mailbox.put(pos, listname, _, stack, player) return -1 else minetest.chat_send_player(player:get_player_name(), - "The mailbox is full") + S("The mailbox is full.")) end end @@ -163,7 +165,7 @@ function mailbox.allow_move(pos) end xdecor.register("mailbox", { - description = "Mailbox", + description = S("Mailbox"), tiles = {"xdecor_mailbox_top.png", "xdecor_mailbox_bottom.png", "xdecor_mailbox_side.png", "xdecor_mailbox_side.png", "xdecor_mailbox.png", "xdecor_mailbox.png"}, @@ -187,4 +189,4 @@ minetest.register_craft({ {"dye:red", "default:paper", "dye:red"}, {"default:steel_ingot", "default:steel_ingot", "default:steel_ingot"} } -}) \ No newline at end of file +}) diff --git a/src/mechanisms.lua b/src/mechanisms.lua index 0a3bcfd..328f503 100644 --- a/src/mechanisms.lua +++ b/src/mechanisms.lua @@ -5,12 +5,14 @@ minetest.setting_set("nodetimer_interval", 0.1) local plate = {} screwdriver = screwdriver or {} +local S = minetest.get_translator("xdecor") + local function door_toggle(pos_actuator, pos_door, player) local player_name = player:get_player_name() local actuator = minetest.get_node(pos_actuator) local door = doors.get(pos_door) if not door then return end - + if actuator.name:sub(-4) == "_off" then minetest.set_node(pos_actuator, {name = actuator.name:gsub("_off", "_on"), param2 = actuator.param2}) @@ -55,7 +57,7 @@ end function plate.register(material, desc, def) xdecor.register("pressure_" .. material .. "_off", { - description = desc .. " Pressure Plate", + description = def.description or (desc .. " Pressure Plate"), tiles = {"xdecor_pressure_" .. material .. ".png"}, drawtype = "nodebox", node_box = xdecor.pixelbox(16, {{1, 0, 1, 14, 1, 14}}), @@ -80,16 +82,18 @@ end plate.register("wood", "Wooden", { sounds = default.node_sound_wood_defaults(), - groups = {choppy = 3, oddly_breakable_by_hand = 2, flammable = 2} + groups = {choppy = 3, oddly_breakable_by_hand = 2, flammable = 2}, + description = S("Wooden Pressure Plate"), }) plate.register("stone", "Stone", { sounds = default.node_sound_stone_defaults(), - groups = {cracky = 3, oddly_breakable_by_hand = 2} + groups = {cracky = 3, oddly_breakable_by_hand = 2}, + description = S("Stone Pressure Plate"), }) xdecor.register("lever_off", { - description = "Lever", + description = S("Lever"), tiles = {"xdecor_lever_off.png"}, drawtype = "nodebox", node_box = xdecor.pixelbox(16, {{2, 1, 15, 12, 14, 1}}), diff --git a/src/nodes.lua b/src/nodes.lua index 31d7430..fae8aba 100644 --- a/src/nodes.lua +++ b/src/nodes.lua @@ -1,4 +1,5 @@ screwdriver = screwdriver or {} +local S = minetest.get_translator("xdecor") local function register_pane(name, desc, def) xpanes.register_pane(name, { @@ -15,7 +16,7 @@ local function register_pane(name, desc, def) }) end -register_pane("bamboo_frame", "Bamboo Frame", { +register_pane("bamboo_frame", S("Bamboo Frame"), { groups = {choppy = 3, oddly_breakable_by_hand = 2, pane = 1, flammable = 2}, recipe = { {"default:papyrus", "default:papyrus", "default:papyrus"}, @@ -24,7 +25,7 @@ register_pane("bamboo_frame", "Bamboo Frame", { } }) -register_pane("chainlink", "Chainlink", { +register_pane("chainlink", S("Chainlink"), { groups = {cracky = 3, oddly_breakable_by_hand = 2, pane = 1}, recipe = { {"default:steel_ingot", "", "default:steel_ingot"}, @@ -33,7 +34,7 @@ register_pane("chainlink", "Chainlink", { } }) -register_pane("rusty_bar", "Rusty Iron Bars", { +register_pane("rusty_bar", S("Rusty Iron Bars"), { sounds = default.node_sound_stone_defaults(), groups = {cracky = 2, pane = 1}, recipe = { @@ -43,7 +44,7 @@ register_pane("rusty_bar", "Rusty Iron Bars", { } }) -register_pane("wood_frame", "Wood Frame", { +register_pane("wood_frame", S("Wood Frame"), { sounds = default.node_sound_wood_defaults(), groups = {choppy = 2, pane = 1, flammable = 2}, recipe = { @@ -54,7 +55,7 @@ register_pane("wood_frame", "Wood Frame", { }) xdecor.register("baricade", { - description = "Baricade", + description = S("Baricade"), drawtype = "plantlike", paramtype2 = "facedir", inventory_image = "xdecor_baricade.png", @@ -66,7 +67,7 @@ xdecor.register("baricade", { }) xdecor.register("barrel", { - description = "Barrel", + description = S("Barrel"), tiles = {"xdecor_barrel_top.png", "xdecor_barrel_top.png", "xdecor_barrel_sides.png"}, on_place = minetest.rotate_node, groups = {choppy = 2, oddly_breakable_by_hand = 1, flammable = 2}, @@ -87,7 +88,7 @@ local function register_storage(name, desc, def) }) end -register_storage("cabinet", "Wooden Cabinet", { +register_storage("cabinet", S("Wooden Cabinet"), { on_rotate = screwdriver.rotate_simple, tiles = { "xdecor_cabinet_sides.png", "xdecor_cabinet_sides.png", @@ -96,7 +97,7 @@ register_storage("cabinet", "Wooden Cabinet", { } }) -register_storage("cabinet_half", "Half Wooden Cabinet", { +register_storage("cabinet_half", S("Half Wooden Cabinet"), { inv_size = 8, node_box = xdecor.nodebox.slab_y(0.5, 0.5), on_rotate = screwdriver.rotate_simple, @@ -110,7 +111,7 @@ register_storage("cabinet_half", "Half Wooden Cabinet", { if minetest.get_modpath("moreblocks") then minetest.register_alias("xdecor:empty_shelf", "moreblocks:empty_shelf") else - register_storage("empty_shelf", "Empty Shelf", { + register_storage("empty_shelf", S("Empty Shelf"), { on_rotate = screwdriver.rotate_simple, tiles = { "default_wood.png", "default_wood.png", "default_wood.png", @@ -119,7 +120,7 @@ else }) end -register_storage("multishelf", "Multi Shelf", { +register_storage("multishelf", S("Multi Shelf"), { on_rotate = screwdriver.rotate_simple, tiles = { "default_wood.png", "default_wood.png", "default_wood.png", @@ -128,7 +129,7 @@ register_storage("multishelf", "Multi Shelf", { }) xdecor.register("candle", { - description = "Candle", + description = S("Candle"), light_source = 12, drawtype = "torchlike", inventory_image = "xdecor_candle_inv.png", @@ -159,7 +160,7 @@ xdecor.register("candle", { }) xdecor.register("chair", { - description = "Chair", + description = S("Chair"), tiles = {"xdecor_wood.png"}, sounds = default.node_sound_wood_defaults(), groups = {choppy = 3, oddly_breakable_by_hand = 2, flammable = 2}, @@ -181,7 +182,7 @@ xdecor.register("chair", { }) xdecor.register("cobweb", { - description = "Cobweb", + description = S("Cobweb"), drawtype = "plantlike", tiles = {"xdecor_cobweb.png"}, inventory_image = "xdecor_cobweb.png", @@ -198,12 +199,12 @@ xdecor.register("cobweb", { }) local curtain_colors = { - "red", + red = S("Red Curtain"), } -for _, c in ipairs(curtain_colors) do +for c, desc in pairs(curtain_colors) do xdecor.register("curtain_" .. c, { - description = c:gsub("^%l", string.upper) .. " Curtain", + description = desc, walkable = false, tiles = {"wool_white.png"}, color = c, @@ -245,7 +246,7 @@ for _, c in ipairs(curtain_colors) do end xdecor.register("cushion", { - description = "Cushion", + description = S("Cushion"), tiles = {"xdecor_cushion.png"}, groups = {snappy = 3, flammable = 3, fall_damage_add_percent = -50}, on_place = minetest.rotate_node, @@ -259,7 +260,7 @@ xdecor.register("cushion", { }) xdecor.register("cushion_block", { - description = "Cushion Block", + description = S("Cushion Block"), tiles = {"xdecor_cushion.png"}, groups = {snappy = 3, flammable = 3, fall_damage_add_percent = -75, not_in_creative_inventory = 1} }) @@ -270,34 +271,52 @@ end local xdecor_doors = { japanese = { - {"group:wood", "default:paper"}, - {"default:paper", "group:wood"}, - {"group:wood", "default:paper"} + recipe = { + {"group:wood", "default:paper"}, + {"default:paper", "group:wood"}, + {"group:wood", "default:paper"} + }, + desc = S("Japanese Door"), }, prison = { - {"xpanes:bar_flat", "xpanes:bar_flat",}, - {"xpanes:bar_flat", "xpanes:bar_flat",}, - {"xpanes:bar_flat", "xpanes:bar_flat"} + recipe = { + {"xpanes:bar_flat", "xpanes:bar_flat",}, + {"xpanes:bar_flat", "xpanes:bar_flat",}, + {"xpanes:bar_flat", "xpanes:bar_flat"} + }, + desc = S("Prison Door"), }, rusty_prison = { - {"xpanes:rusty_bar_flat", "xpanes:rusty_bar_flat",}, - {"xpanes:rusty_bar_flat", "xpanes:rusty_bar_flat",}, - {"xpanes:rusty_bar_flat", "xpanes:rusty_bar_flat"} + recipe = { + {"xpanes:rusty_bar_flat", "xpanes:rusty_bar_flat",}, + {"xpanes:rusty_bar_flat", "xpanes:rusty_bar_flat",}, + {"xpanes:rusty_bar_flat", "xpanes:rusty_bar_flat"} + }, + desc = S("Rusty Prison Door"), }, screen = { - {"group:wood", "group:wood"}, - {"xpanes:chainlink_flat", "xpanes:chainlink_flat"}, - {"group:wood", "group:wood"} + recipe = { + {"group:wood", "group:wood"}, + {"xpanes:chainlink_flat", "xpanes:chainlink_flat"}, + {"group:wood", "group:wood"} + }, + desc = S("Screen Door"), }, slide = { - {"default:paper", "default:paper"}, - {"default:paper", "default:paper"}, - {"group:wood", "group:wood"} + recipe = { + {"default:paper", "default:paper"}, + {"default:paper", "default:paper"}, + {"group:wood", "group:wood"} + }, + desc = S("Slide Door"), }, woodglass = { - {"default:glass", "default:glass"}, - {"group:wood", "group:wood"}, - {"group:wood", "group:wood"} + recipe = { + {"default:glass", "default:glass"}, + {"group:wood", "group:wood"}, + {"group:wood", "group:wood"} + }, + desc = S("Woodglass Door"), }, } @@ -321,23 +340,23 @@ if minetest.global_exists("mesecon") then }} end -for name, recipe in pairs(xdecor_doors) do +for name, def in pairs(xdecor_doors) do if not doors.register then break end doors.register(name .. "_door", { tiles = { {name = "xdecor_" .. name .. "_door.png", backface_culling = true} }, - description = name:gsub("%f[%w]%l", string.upper):gsub("_", " ") .. " Door", + description = def.desc, inventory_image = "xdecor_" .. name .. "_door_inv.png", protected = door_access(name), groups = {choppy = 2, cracky = 2, oddly_breakable_by_hand = 1, door = 1}, - recipe = recipe, + recipe = def.recipe, mesecons = mesecons_register, }) end xdecor.register("enderchest", { - description = "Ender Chest", + description = S("Ender Chest"), tiles = { "xdecor_enderchest_top.png", "xdecor_enderchest_top.png", "xdecor_enderchest_side.png", "xdecor_enderchest_side.png", @@ -355,7 +374,7 @@ xdecor.register("enderchest", { listring[current_player;main] ]] .. xbg .. default.get_hotbar_bg(0,5)) - meta:set_string("infotext", "Ender Chest") + meta:set_string("infotext", S("Ender Chest")) end }) @@ -365,7 +384,7 @@ minetest.register_on_joinplayer(function(player) end) xdecor.register("ivy", { - description = "Ivy", + description = S("Ivy"), drawtype = "signlike", walkable = false, climbable = true, @@ -379,7 +398,7 @@ xdecor.register("ivy", { }) xdecor.register("lantern", { - description = "Lantern", + description = S("Lantern"), light_source = 13, drawtype = "plantlike", inventory_image = "xdecor_lantern_inv.png", @@ -396,9 +415,14 @@ xdecor.register("lantern", { selection_box = xdecor.pixelbox(16, {{4, 0, 4, 8, 16, 8}}) }) -for _, l in ipairs({"iron", "wooden"}) do +local xdecor_lightbox = { + iron = S("Iron Light Box"), + wooden = S("Wooden Light Box"), +} + +for l, desc in pairs(xdecor_lightbox) do xdecor.register(l .. "_lightbox", { - description = l:gsub("^%l", string.upper) .. " Light Box", + description = desc, tiles = {"xdecor_" .. l .. "_lightbox.png"}, groups = {cracky = 3, choppy = 3, oddly_breakable_by_hand = 2}, light_source = 13, @@ -406,10 +430,18 @@ for _, l in ipairs({"iron", "wooden"}) do }) end -for _, f in ipairs({"dandelion_white", "dandelion_yellow", "geranium", - "rose", "tulip", "viola"}) do +local xdecor_potted = { + dandelion_white = S("Potted White Dandelion"), + dandelion_yellow = S("Potted Yellow Dandelion"), + geranium = S("Potted Geranium"), + rose = S("Potted Rose"), + tulip = S("Potted Tulip"), + viola = S("Potted Viola"), +} + +for f, desc in pairs(xdecor_potted) do xdecor.register("potted_" .. f, { - description = "Potted " .. f:gsub("%f[%w]%l", string.upper):gsub("_", " "), + description = desc, walkable = false, groups = {snappy = 3, flammable = 3, plant = 1, flower = 1}, tiles = {"xdecor_" .. f .. "_pot.png"}, @@ -436,7 +468,7 @@ local painting_box = { } xdecor.register("painting_1", { - description = "Painting", + description = S("Painting"), tiles = {"xdecor_painting_1.png"}, inventory_image = "xdecor_painting_empty.png", wield_image = "xdecor_painting_empty.png", @@ -479,7 +511,7 @@ for i = 2, 4 do end xdecor.register("stonepath", { - description = "Garden Stone Path", + description = S("Garden Stone Path"), tiles = {"default_stone.png"}, groups = {snappy = 3}, on_rotate = screwdriver.rotate_simple, @@ -502,26 +534,26 @@ local function register_hard_node(name, desc, def) }) end -register_hard_node("cactusbrick", "Cactus Brick") -register_hard_node("coalstone_tile", "Coal Stone Tile") -register_hard_node("desertstone_tile", "Desert Stone Tile") -register_hard_node("hard_clay", "Hardened Clay") -register_hard_node("moonbrick", "Moon Brick") -register_hard_node("stone_tile", "Stone Tile") -register_hard_node("stone_rune", "Runestone") +register_hard_node("cactusbrick", S("Cactus Brick")) +register_hard_node("coalstone_tile", S("Coal Stone Tile")) +register_hard_node("desertstone_tile", S("Desert Stone Tile")) +register_hard_node("hard_clay", S("Hardened Clay")) +register_hard_node("moonbrick", S("Moon Brick")) +register_hard_node("stone_tile", S("Stone Tile")) +register_hard_node("stone_rune", S("Runestone")) -register_hard_node("packed_ice", "Packed Ice", { +register_hard_node("packed_ice", S("Packed Ice"), { groups = {cracky = 1, puts_out_fire = 1, slippery = 3}, sounds = default.node_sound_glass_defaults() }) -register_hard_node("wood_tile", "Wooden Tile", { +register_hard_node("wood_tile", S("Wooden Tile"), { groups = {choppy = 1, wood = 1, flammable = 2}, sounds = default.node_sound_wood_defaults() }) xdecor.register("table", { - description = "Table", + description = S("Table"), tiles = {"xdecor_wood.png"}, groups = {choppy = 2, oddly_breakable_by_hand = 1, flammable = 2}, sounds = default.node_sound_wood_defaults(), @@ -531,7 +563,7 @@ xdecor.register("table", { }) xdecor.register("tatami", { - description = "Tatami", + description = S("Tatami"), tiles = {"xdecor_tatami.png"}, wield_image = "xdecor_tatami.png", groups = {snappy = 3, flammable = 3}, @@ -540,7 +572,7 @@ xdecor.register("tatami", { }) xdecor.register("trampoline", { - description = "Trampoline", + description = S("Trampoline"), tiles = {"xdecor_trampoline.png", "mailbox_blank16.png", "xdecor_trampoline_sides.png"}, groups = {cracky = 3, oddly_breakable_by_hand = 1, fall_damage_add_percent = -80, bouncy = 90}, node_box = xdecor.nodebox.slab_y(0.5), @@ -553,7 +585,7 @@ xdecor.register("trampoline", { }) xdecor.register("tv", { - description = "Television", + description = S("Television"), light_source = 11, groups = {cracky = 3, oddly_breakable_by_hand = 2}, on_rotate = screwdriver.rotate_simple, @@ -570,7 +602,7 @@ xdecor.register("tv", { }) xdecor.register("woodframed_glass", { - description = "Wood Framed Glass", + description = S("Wood Framed Glass"), drawtype = "glasslike_framed", sunlight_propagates = true, tiles = {"xdecor_woodframed_glass.png", "xdecor_woodframed_glass_detail.png"}, diff --git a/src/rope.lua b/src/rope.lua index 8199db2..4380205 100644 --- a/src/rope.lua +++ b/src/rope.lua @@ -1,4 +1,5 @@ local rope = {} +local S = minetest.get_translator("xdecor") -- Code by Mirko K. (modified by Temperest, Wulfsdad and kilbith) (License: GPL). function rope.place(itemstack, placer, pointed_thing) @@ -41,7 +42,7 @@ function rope.remove(pos, oldnode, digger, rope_name) end xdecor.register("rope", { - description = "Rope", + description = S("Rope"), drawtype = "plantlike", walkable = false, climbable = true, diff --git a/src/workbench.lua b/src/workbench.lua index 49ca30b..e73e4f3 100644 --- a/src/workbench.lua +++ b/src/workbench.lua @@ -3,6 +3,8 @@ WB = {} screwdriver = screwdriver or {} local min, ceil = math.min, math.ceil local registered_nodes = minetest.registered_nodes +local S = minetest.get_translator("xdecor") +local FS = function(...) return minetest.formspec_escape(S(...)) end -- Nodes allowed to be cut -- Only the regular, solid blocks without metas or explosivity can be cut @@ -75,14 +77,13 @@ function workbench:get_output(inv, input, name) inv:set_list("forms", output) end -local main_fs = [[ - label[0.9,1.23;Cut] - label[0.9,2.23;Repair] - box[-0.05,1;2.05,0.9;#555555] - box[-0.05,2;2.05,0.9;#555555] - button[0,0;2,1;craft;Crafting] - button[2,0;2,1;storage;Storage] - image[3,1;1,1;gui_furnace_arrow_bg.png^[transformR270] +local main_fs = "label[0.9,1.23;"..FS("Cut").."]" + .."label[0.9,2.23;"..FS("Repair").."]" + ..[[ box[-0.05,1;2.05,0.9;#555555] + box[-0.05,2;2.05,0.9;#555555] ]] + .."button[0,0;2,1;craft;"..FS("Crafting").."]" + .."button[2,0;2,1;storage;"..FS("Storage").."]" + ..[[ image[3,1;1,1;gui_furnace_arrow_bg.png^[transformR270] image[0,1;1,1;worktable_saw.png] image[0,2;1,1;worktable_anvil.png] image[3,2;1,1;hammer_layout.png] @@ -100,19 +101,17 @@ local main_fs = [[ listring[context;input] ]] -local crafting_fs = [[ - image[5,1;1,1;gui_furnace_arrow_bg.png^[transformR270] - button[0,0;1.5,1;back;< Back] - list[current_player;craft;2,0;3,3;] +local crafting_fs = "image[5,1;1,1;gui_furnace_arrow_bg.png^[transformR270]" + .."button[0,0;1.5,1;back;< "..FS("Back").."]" + ..[[ list[current_player;craft;2,0;3,3;] list[current_player;craftpreview;6,1;1,1;] listring[current_player;main] listring[current_player;craft] ]] -local storage_fs = [[ - list[context;storage;0,1;8,2;] - button[0,0;1.5,1;back;< Back] - listring[context;storage] +local storage_fs = "list[context;storage;0,1;8,2;]" + .."button[0,0;1.5,1;back;< "..FS("Back").."]" + ..[[listring[context;storage] listring[current_player;main] ]] @@ -143,7 +142,7 @@ function workbench.construct(pos) inv:set_size("forms", 4*3) inv:set_size("storage", 8*2) - meta:set_string("infotext", "Work Bench") + meta:set_string("infotext", S("Work Bench")) workbench:set_formspec(meta, 1) end @@ -254,7 +253,7 @@ function workbench.on_take(pos, listname, index, stack, player) end xdecor.register("workbench", { - description = "Work Bench", + description = S("Work Bench"), groups = {cracky = 2, choppy = 2, oddly_breakable_by_hand = 1}, sounds = default.node_sound_wood_defaults(), tiles = { @@ -302,6 +301,7 @@ for i = 1, #nodes do tiles = {def.tile_images[1]} end + --TODO: Translation support for Stairs/Slab if not registered_nodes["stairs:slab_" .. item_name] then stairs.register_stair_and_slab(item_name, node, groups, tiles, def.description .. " Stair", @@ -309,6 +309,7 @@ for i = 1, #nodes do end minetest.register_node(":" .. node .. "_" .. d[1], { + --TODO: Translation support description = def.description .. " " .. d[1]:gsub("^%l", string.upper), paramtype = "light", paramtype2 = "facedir", @@ -338,7 +339,7 @@ end -- Craft items minetest.register_tool("xdecor:hammer", { - description = "Hammer", + description = S("Hammer"), inventory_image = "xdecor_hammer.png", wield_image = "xdecor_hammer.png", on_use = function() do