From 342202c979103870156680497b4aab00a5dbf6d7 Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Thu, 7 Mar 2019 21:35:02 +0100 Subject: [PATCH] New translation system, part 5: Items, part 1 --- mods/ITEMS/mcl_anvils/init.lua | 26 ++++---- mods/ITEMS/mcl_banners/init.lua | 40 ++++++------ mods/ITEMS/mcl_banners/patterncraft.lua | 82 +++++++++++++------------ mods/ITEMS/mcl_beds/api.lua | 13 ++-- mods/ITEMS/mcl_beds/beds.lua | 34 +++++----- mods/ITEMS/mcl_beds/functions.lua | 20 +++--- mods/ITEMS/mcl_books/init.lua | 52 ++++++++-------- mods/ITEMS/mcl_bows/arrow.lua | 12 ++-- mods/ITEMS/mcl_bows/bow.lua | 12 ++-- 9 files changed, 153 insertions(+), 138 deletions(-) diff --git a/mods/ITEMS/mcl_anvils/init.lua b/mods/ITEMS/mcl_anvils/init.lua index 8b3717a34..0eae2ce5a 100644 --- a/mods/ITEMS/mcl_anvils/init.lua +++ b/mods/ITEMS/mcl_anvils/init.lua @@ -1,3 +1,5 @@ +local S = minetest.get_translator("mcl_anvils") + local MAX_NAME_LENGTH = 30 local MAX_WEAR = 65535 local SAME_TOOL_REPAIR_BOOST = math.ceil(MAX_WEAR * 0.12) -- 12% @@ -23,7 +25,7 @@ local function get_anvil_formspec(set_name) "list[context;output;8,2.5;1,1;]".. "field[3.25,1;4,1;name;;"..minetest.formspec_escape(set_name).."]".. "field_close_on_enter[name;false]".. - "button[7,0.7;2,1;name_button;Set Name]".. + "button[7,0.7;2,1;name_button;"..minetest.formspec_escape(S("Set Name")).."]".. "listring[context;output]".. "listring[current_player;main]".. "listring[context;input]".. @@ -433,20 +435,20 @@ if minetest.get_modpath("screwdriver") then end local anvildef0 = table.copy(anvildef) -anvildef0.description = "Anvil" +anvildef0.description = S("Anvil") anvildef0._doc_items_longdesc = -[[The anvil allows you to repair tools and armor, and to give names to items. It has a limited durability, however. Don't let it fall on your head, it could be quite painful!]] +S("The anvil allows you to repair tools and armor, and to give names to items. It has a limited durability, however. Don't let it fall on your head, it could be quite painful!") anvildef0._doc_items_usagehelp = -"To use an anvil, rightclick it. An anvil has 2 input slots (on the left) and one output slot.".."\n".. -"To rename items, put an item stack in one of the item slots while keeping the other input slot empty. Type in a name, hit enter or “Set Name”, then take the renamed item from the output slot.".."\n".. -"There are two possibilities to repair tools (and armor):".."\n".. -"• Tool + Tool: Place two tools of the same type in the input slots. The “health” of the repaired tool is the sum of the “health” of both input tools, plus a 12% bonus.".."\n".. -"• Tool + Material: Some tools can also be repaired by combining them with an item that it's made of. For example, iron pickaxes can be repaired with iron ingots. This repairs the tool by 25%.".."\n".. -"Armor counts as a tool. It is possible to repair and rename a tool in a single step.".."\n\n".. -"The anvil has limited durability and 3 damage levels: undamaged, slightly damaged and very damaged. Each time you repair or rename something, there is a 12% chance the anvil gets damaged. Anvils also have a chance of being damaged when they fall by more than 1 block. If a very damaged anvil is damaged again, it is destroyed." +S("To use an anvil, rightclick it. An anvil has 2 input slots (on the left) and one output slot.").."\n".. +S("To rename items, put an item stack in one of the item slots while keeping the other input slot empty. Type in a name, hit enter or “Set Name”, then take the renamed item from the output slot.").."\n".. +S("There are two possibilities to repair tools (and armor):").."\n".. +S("• Tool + Tool: Place two tools of the same type in the input slots. The “health” of the repaired tool is the sum of the “health” of both input tools, plus a 12% bonus.").."\n".. +S("• Tool + Material: Some tools can also be repaired by combining them with an item that it's made of. For example, iron pickaxes can be repaired with iron ingots. This repairs the tool by 25%.").."\n".. +S("Armor counts as a tool. It is possible to repair and rename a tool in a single step.").."\n\n".. +S("The anvil has limited durability and 3 damage levels: undamaged, slightly damaged and very damaged. Each time you repair or rename something, there is a 12% chance the anvil gets damaged. Anvils also have a chance of being damaged when they fall by more than 1 block. If a very damaged anvil is damaged again, it is destroyed.") local anvildef1 = table.copy(anvildef) -anvildef1.description = "Slightly Damaged Anvil" +anvildef1.description = S("Slightly Damaged Anvil") anvildef1._doc_items_create_entry = false anvildef1.groups.not_in_creative_inventory = 1 anvildef1.groups.anvil = 2 @@ -454,7 +456,7 @@ anvildef1._doc_items_create_entry = false anvildef1.tiles = {"mcl_anvils_anvil_top_damaged_1.png^[transformR90", "mcl_anvils_anvil_base.png", "mcl_anvils_anvil_side.png"} local anvildef2 = table.copy(anvildef) -anvildef2.description = "Very Damaged Anvil" +anvildef2.description = S("Very Damaged Anvil") anvildef2._doc_items_create_entry = false anvildef2.groups.not_in_creative_inventory = 1 anvildef2.groups.anvil = 3 diff --git a/mods/ITEMS/mcl_banners/init.lua b/mods/ITEMS/mcl_banners/init.lua index d1df29d07..2c7304b96 100644 --- a/mods/ITEMS/mcl_banners/init.lua +++ b/mods/ITEMS/mcl_banners/init.lua @@ -1,3 +1,5 @@ +local S = minetest.get_translator("mcl_banners") + local node_sounds if minetest.get_modpath("mcl_sounds") then node_sounds = mcl_sounds.node_sound_wood_defaults() @@ -14,22 +16,22 @@ mcl_banners = {} mcl_banners.colors = { -- Format: -- [ID] = { banner description, wool, unified dyes color group, overlay color, dye, color name for emblazonings } - ["unicolor_white"] = {"white", "White Banner", "mcl_wool:white", "#FFFFFF", "mcl_dye:white", "White" }, - ["unicolor_darkgrey"] = {"grey", "Grey Banner", "mcl_wool:grey", "#303030", "mcl_dye:dark_grey", "Grey" }, - ["unicolor_grey"] = {"silver", "Light Grey Banner", "mcl_wool:silver", "#5B5B5B", "mcl_dye:grey", "Light Grey" }, - ["unicolor_black"] = {"black", "Black Banner", "mcl_wool:black", "#000000", "mcl_dye:black", "Black" }, - ["unicolor_red"] = {"red", "Red Banner", "mcl_wool:red", "#BC0000", "mcl_dye:red", "Red" }, - ["unicolor_yellow"] = {"yellow", "Yellow Banner", "mcl_wool:yellow", "#E6CD00", "mcl_dye:yellow", "Yellow" }, - ["unicolor_dark_green"] = {"green", "Green Banner", "mcl_wool:green", "#006000", "mcl_dye:dark_green", "Green" }, - ["unicolor_cyan"] = {"cyan", "Cyan Banner", "mcl_wool:cyan", "#00ACAC", "mcl_dye:cyan", "Cyan" }, - ["unicolor_blue"] = {"blue", "Blue Banner", "mcl_wool:blue", "#0000AC", "mcl_dye:blue", "Blue" }, - ["unicolor_red_violet"] = {"magenta", "Magenta Banner", "mcl_wool:magenta", "#AC007C", "mcl_dye:magenta", "Magenta"}, - ["unicolor_orange"] = {"orange", "Orange Banner", "mcl_wool:orange", "#E67300", "mcl_dye:orange", "Orange" }, - ["unicolor_violet"] = {"purple", "Purple Banner", "mcl_wool:purple", "#6400AC", "mcl_dye:violet", "Violet" }, - ["unicolor_brown"] = {"brown", "Brown Banner", "mcl_wool:brown", "#603000", "mcl_dye:brown", "Brown" }, - ["unicolor_pink"] = {"pink", "Pink Banner", "mcl_wool:pink", "#DE557C", "mcl_dye:pink", "Pink" }, - ["unicolor_lime"] = {"lime", "Lime Banner", "mcl_wool:lime", "#30AC00", "mcl_dye:green", "Lime" }, - ["unicolor_light_blue"] = {"light_blue", "Light Blue Banner", "mcl_wool:light_blue", "#4040CF", "mcl_dye:lightblue", "Light Blue" }, + ["unicolor_white"] = {"white", S("White Banner"), "mcl_wool:white", "#FFFFFF", "mcl_dye:white", "White" }, + ["unicolor_darkgrey"] = {"grey", S("Grey Banner"), "mcl_wool:grey", "#303030", "mcl_dye:dark_grey", "Grey" }, + ["unicolor_grey"] = {"silver", S("Light Grey Banner"), "mcl_wool:silver", "#5B5B5B", "mcl_dye:grey", "Light Grey" }, + ["unicolor_black"] = {"black", S("Black Banner"), "mcl_wool:black", "#000000", "mcl_dye:black", "Black" }, + ["unicolor_red"] = {"red", S("Red Banner"), "mcl_wool:red", "#BC0000", "mcl_dye:red", "Red" }, + ["unicolor_yellow"] = {"yellow", S("Yellow Banner"), "mcl_wool:yellow", "#E6CD00", "mcl_dye:yellow", "Yellow" }, + ["unicolor_dark_green"] = {"green", S("Green Banner"), "mcl_wool:green", "#006000", "mcl_dye:dark_green", "Green" }, + ["unicolor_cyan"] = {"cyan", S("Cyan Banner"), "mcl_wool:cyan", "#00ACAC", "mcl_dye:cyan", "Cyan" }, + ["unicolor_blue"] = {"blue", S("Blue Banner"), "mcl_wool:blue", "#0000AC", "mcl_dye:blue", "Blue" }, + ["unicolor_red_violet"] = {"magenta", S("Magenta Banner"), "mcl_wool:magenta", "#AC007C", "mcl_dye:magenta", "Magenta"}, + ["unicolor_orange"] = {"orange", S("Orange Banner"), "mcl_wool:orange", "#E67300", "mcl_dye:orange", "Orange" }, + ["unicolor_violet"] = {"purple", S("Purple Banner"), "mcl_wool:purple", "#6400AC", "mcl_dye:violet", "Violet" }, + ["unicolor_brown"] = {"brown", S("Brown Banner"), "mcl_wool:brown", "#603000", "mcl_dye:brown", "Brown" }, + ["unicolor_pink"] = {"pink", S("Pink Banner"), "mcl_wool:pink", "#DE557C", "mcl_dye:pink", "Pink" }, + ["unicolor_lime"] = {"lime", S("Lime Banner"), "mcl_wool:lime", "#30AC00", "mcl_dye:green", "Lime" }, + ["unicolor_light_blue"] = {"light_blue", S("Light Blue Banner"), "mcl_wool:light_blue", "#4040CF", "mcl_dye:lightblue", "Light Blue" }, } local colors_reverse = {} @@ -192,9 +194,9 @@ end minetest.register_node("mcl_banners:standing_banner", { _doc_items_entry_name = "Banner", _doc_items_image = "mcl_banners_item_base.png^mcl_banners_item_overlay.png", - _doc_items_longdesc = "Banners are tall colorful decorative blocks. They can be placed on the floor and at walls. Banners can be emblazoned with a variety of patterns using a lot of dye in crafting.", - _doc_items_usagehelp = [[Use crafting to draw a pattern on top of the banner. Emblazoned banners can be emblazoned again to combine various patterns. You can draw up to 12 layers on a banner that way. If the banner includes a gradient, only 3 layers are possible. -You can copy the pattern of a banner by placing two banners of the same color in the crafting grid—one needs to be emblazoned, the other one must be clean. Finally, you can use a banner on a cauldron with water to wash off its top-most layer.]], + _doc_items_longdesc = S("Banners are tall colorful decorative blocks. They can be placed on the floor and at walls. Banners can be emblazoned with a variety of patterns using a lot of dye in crafting."), + _doc_items_usagehelp = S("Use crafting to draw a pattern on top of the banner. Emblazoned banners can be emblazoned again to combine various patterns. You can draw up to 12 layers on a banner that way. If the banner includes a gradient, only 3 layers are possible.").."\n".. +S("You can copy the pattern of a banner by placing two banners of the same color in the crafting grid—one needs to be emblazoned, the other one must be clean. Finally, you can use a banner on a cauldron with water to wash off its top-most layer."), walkable = false, is_ground_content = false, paramtype = "light", diff --git a/mods/ITEMS/mcl_banners/patterncraft.lua b/mods/ITEMS/mcl_banners/patterncraft.lua index f60d5678c..5518f883f 100644 --- a/mods/ITEMS/mcl_banners/patterncraft.lua +++ b/mods/ITEMS/mcl_banners/patterncraft.lua @@ -1,3 +1,5 @@ +local S = minetest.get_translator("mcl_banners") + -- Pattern crafting. This file contains the code for crafting all the -- emblazonings you can put on the banners. It's quite complicated; -- run-of-the-mill crafting won't work here. @@ -17,99 +19,99 @@ local d = "group:dye" -- dye local e = "" -- empty slot (one of them must contain the banner) local patterns = { ["border"] = { - name = "%s Bordure", + name = S("%s Bordure"), { d, d, d }, { d, e, d }, { d, d, d }, }, ["bricks"] = { - name = "%s Bricks", + name = S("%s Bricks"), type = "shapeless", { e, "mcl_core:brick_block", d }, }, ["circle"] = { - name = "%s Roundel", + name = S("%s Roundel"), { e, e, e }, { e, d, e }, { e, e, e }, }, ["creeper"] = { - name = "%s Creeper Charge", + name = S("%s Creeper Charge"), type = "shapeless", { e, "mcl_heads:creeper", d }, }, ["cross"] = { - name = "%s Saltire", + name = S("%s Saltire"), { d, e, d }, { e, d, e }, { d, e, d }, }, ["curly_border"] = { - name = "%s Bordure Indented", + name = S("%s Bordure Indented"), type = "shapeless", { e, "mcl_core:vine", d }, }, ["diagonal_up_left"] = { - name = "%s Per Bend Inverted", + name = S("%s Per Bend Inverted"), { e, e, e }, { d, e, e }, { d, d, e }, }, ["diagonal_up_right"] = { - name = "%s Per Bend Sinister Inverted", + name = S("%s Per Bend Sinister Inverted"), { e, e, e }, { e, e, d }, { e, d, d }, }, ["diagonal_right"] = { - name = "%s Per Bend", + name = S("%s Per Bend"), { e, d, d }, { e, e, d }, { e, e, e }, }, ["diagonal_left"] = { - name = "%s Per Bend Sinister", + name = S("%s Per Bend Sinister"), { d, d, e }, { d, e, e }, { e, e, e }, }, ["flower"] = { - name = "%s Flower Charge", + name = S("%s Flower Charge"), type = "shapeless", { e, "mcl_flowers:oxeye_daisy", d }, }, ["gradient"] = { - name = "%s Gradient", + name = S("%s Gradient"), { d, e, d }, { e, d, e }, { e, d, e }, }, ["gradient_up"] = { - name = "%s Base Gradient", + name = S("%s Base Gradient"), { e, d, e }, { e, d, e }, { d, e, d }, }, ["half_horizontal_bottom"] = { - name = "%s Per Fess Inverted", + name = S("%s Per Fess Inverted"), { e, e, e }, { d, d, d }, { d, d, d }, }, ["half_horizontal"] = { - name = "%s Per Fess", + name = S("%s Per Fess"), { d, d, d }, { d, d, d }, { e, e, e }, }, ["half_vertical"] = { - name = "%s Per Pale", + name = S("%s Per Pale"), { d, d, e }, { d, d, e }, { d, d, e }, }, ["half_vertical_right"] = { - name = "%s Per Pale Inverted", + name = S("%s Per Pale Inverted"), { e, d, d }, { e, d, d }, { e, d, d }, @@ -117,126 +119,126 @@ local patterns = { ["thing"] = { -- Symbol used for the “Thing”: U+1F65D 🙝 - name = "%s Thing Charge", + name = S("%s Thing Charge"), type = "shapeless", -- TODO: Replace with enchanted golden apple { e, "mcl_core:apple_gold", d }, }, ["rhombus"] = { - name = "%s Lozenge", + name = S("%s Lozenge"), { e, d, e }, { d, e, d }, { e, d, e }, }, ["skull"] = { - name = "%s Skull Charge", + name = S("%s Skull Charge"), type = "shapeless", { e, "mcl_heads:wither_skeleton", d }, }, ["small_stripes"] = { - name = "%s Paly", + name = S("%s Paly"), { d, e, d }, { d, e, d }, { e, e, e }, }, ["square_bottom_left"] = { - name = "%s Base Dexter Canton", + name = S("%s Base Dexter Canton"), { e, e, e }, { e, e, e }, { d, e, e }, }, ["square_bottom_right"] = { - name = "%s Base Sinister Canton", + name = S("%s Base Sinister Canton"), { e, e, e }, { e, e, e }, { e, e, d }, }, ["square_top_left"] = { - name = "%s Chief Dexter Canton", + name = S("%s Chief Dexter Canton"), { d, e, e }, { e, e, e }, { e, e, e }, }, ["square_top_right"] = { - name = "%s Chief Sinister Canton", + name = S("%s Chief Sinister Canton"), { e, e, d }, { e, e, e }, { e, e, e }, }, ["straight_cross"] = { - name = "%s Cross", + name = S("%s Cross"), { e, d, e }, { d, d, d }, { e, d, e }, }, ["stripe_bottom"] = { - name = "%s Base", + name = S("%s Base"), { e, e, e }, { e, e, e }, { d, d, d }, }, ["stripe_center"] = { - name = "%s Pale", + name = S("%s Pale"), { e, d, e }, { e, d, e }, { e, d, e }, }, ["stripe_downleft"] = { - name = "%s Bend Sinister", + name = S("%s Bend Sinister"), { e, e, d }, { e, d, e }, { d, e, e }, }, ["stripe_downright"] = { - name = "%s Bend", + name = S("%s Bend"), { d, e, e }, { e, d, e }, { e, e, d }, }, ["stripe_left"] = { - name = "%s Pale Dexter", + name = S("%s Pale Dexter"), { d, e, e }, { d, e, e }, { d, e, e }, }, ["stripe_middle"] = { - name = "%s Fess", + name = S("%s Fess"), { e, e, e }, { d, d, d }, { e, e, e }, }, ["stripe_right"] = { - name = "%s Pale Sinister", + name = S("%s Pale Sinister"), { e, e, d }, { e, e, d }, { e, e, d }, }, ["stripe_top"] = { - name = "%s Chief", + name = S("%s Chief"), { d, d, d }, { e, e, e }, { e, e, e }, }, ["triangle_bottom"] = { - name = "%s Chevron", + name = S("%s Chevron"), { e, e, e }, { e, d, e }, { d, e, d }, }, ["triangle_top"] = { - name = "%s Chevron Inverted", + name = S("%s Chevron Inverted"), { d, e, d }, { e, d, e }, { e, e, e }, }, ["triangles_bottom"] = { - name = "%s Base Indented", + name = S("%s Base Indented"), { e, e, e }, { d, e, d }, { e, d, e }, }, ["triangles_top"] = { - name = "%s Chief Indented", + name = S("%s Chief Indented"), { e, d, e }, { d, e, d }, { e, e, e }, @@ -270,9 +272,9 @@ mcl_banners.make_advanced_banner_description = function(description, layers) end -- Warn about missing information if #layers == max_layer_lines + 1 then - table.insert(layerstrings, "And one addional layer") + table.insert(layerstrings, S("And one addional layer")) elseif #layers > max_layer_lines + 1 then - table.insert(layerstrings, string.format("And %d addional layers", #layers - max_layer_lines)) + table.insert(layerstrings, string.format(S("And %d addional layers"), #layers - max_layer_lines)) end -- Final string concatenations: Just a list of strings diff --git a/mods/ITEMS/mcl_beds/api.lua b/mods/ITEMS/mcl_beds/api.lua index 4fbbe55eb..6c94121b3 100644 --- a/mods/ITEMS/mcl_beds/api.lua +++ b/mods/ITEMS/mcl_beds/api.lua @@ -1,3 +1,4 @@ +local S = minetest.get_translator("mcl_beds") local reverse = true @@ -32,17 +33,17 @@ local function kick_player_after_destruct(destruct_pos) end end -local beddesc = "Beds allow you to sleep at night and make the time pass faster." -local beduse = "To use a bed, stand close to it and right-click the bed to sleep in it. Sleeping only works when the sun sets, at night or during a thunderstorm. The bed must also be clear of any danger." +local beddesc = S("Beds allow you to sleep at night and make the time pass faster.") +local beduse = S("To use a bed, stand close to it and right-click the bed to sleep in it. Sleeping only works when the sun sets, at night or during a thunderstorm. The bed must also be clear of any danger.") if minetest.settings:get_bool("enable_bed_respawn") == false then - beddesc = beddesc .. "\n" .. "In local folklore, legends are told of other worlds where setting the start point for your next life would be possible. But this world is not one of them." + beddesc = beddesc .. "\n" .. S("In local folklore, legends are told of other worlds where setting the start point for your next life would be possible. But this world is not one of them.") else - beddesc = beddesc .. "\n" .. "By using a bed, you set the starting point for your next life. If you die, you will start your next life at this bed, unless it is obstructed or destroyed." + beddesc = beddesc .. "\n" .. S("By using a bed, you set the starting point for your next life. If you die, you will start your next life at this bed, unless it is obstructed or destroyed.") end if minetest.settings:get_bool("enable_bed_night_skip") == false then - beddesc = beddesc .. "\n" .. "In this strange world, going to bed won't skip the night, but you can skip thunderstorms." + beddesc = beddesc .. "\n" .. S("In this strange world, going to bed won't skip the night, but you can skip thunderstorms.") else - beddesc = beddesc .. "\n" .. "Sleeping allows you to skip the night. The night is skipped when all players in this world went to sleep. The night is skipped after sleeping for a few seconds. Thunderstorms can be skipped in the same manner." + beddesc = beddesc .. "\n" .. S("Sleeping allows you to skip the night. The night is skipped when all players in this world went to sleep. The night is skipped after sleeping for a few seconds. Thunderstorms can be skipped in the same manner.") end local default_sounds diff --git a/mods/ITEMS/mcl_beds/beds.lua b/mods/ITEMS/mcl_beds/beds.lua index 40deac70a..6ac2071e5 100644 --- a/mods/ITEMS/mcl_beds/beds.lua +++ b/mods/ITEMS/mcl_beds/beds.lua @@ -1,4 +1,4 @@ --- 3D bed +local S = minetest.get_translator("mcl_beds") local nodebox = { bottom = { @@ -15,22 +15,22 @@ local nodebox = { local colors = { -- { ID, decription, wool, dye } - { "red", "Red Bed", "mcl_wool:red", "mcl_dye:red" }, - { "blue", "Blue Bed", "mcl_wool:blue", "mcl_dye:blue" }, - { "cyan", "Cyan Bed", "mcl_wool:cyan", "mcl_dye:cyan" }, - { "grey", "Grey Bed", "mcl_wool:grey", "mcl_dye:dark_grey" }, - { "silver", "Light Grey Bed", "mcl_wool:silver", "mcl_dye:grey" }, - { "black", "Black Bed", "mcl_wool:black", "mcl_dye:black" }, - { "yellow", "Yellow Bed", "mcl_wool:yellow", "mcl_dye:yellow" }, - { "green", "Green Bed", "mcl_wool:green", "mcl_dye:dark_green" }, - { "magenta", "Magenta Bed", "mcl_wool:magenta", "mcl_dye:magenta" }, - { "orange", "Orange Bed", "mcl_wool:orange", "mcl_dye:orange" }, - { "purple", "Purple Bed", "mcl_wool:purple", "mcl_dye:violet" }, - { "brown", "Brown Bed", "mcl_wool:brown", "mcl_dye:brown" }, - { "pink", "Pink Bed", "mcl_wool:pink", "mcl_dye:pink" }, - { "lime", "Lime Bed", "mcl_wool:lime", "mcl_dye:green" }, - { "light_blue", "Light Blue Bed", "mcl_wool:light_blue", "mcl_dye:lightblue" }, - { "white", "White Bed", "mcl_wool:white", "mcl_dye:white" }, + { "red", S("Red Bed"), "mcl_wool:red", "mcl_dye:red" }, + { "blue", S("Blue Bed"), "mcl_wool:blue", "mcl_dye:blue" }, + { "cyan", S("Cyan Bed"), "mcl_wool:cyan", "mcl_dye:cyan" }, + { "grey", S("Grey Bed"), "mcl_wool:grey", "mcl_dye:dark_grey" }, + { "silver", S("Light Grey Bed"), "mcl_wool:silver", "mcl_dye:grey" }, + { "black", S("Black Bed"), "mcl_wool:black", "mcl_dye:black" }, + { "yellow", S("Yellow Bed"), "mcl_wool:yellow", "mcl_dye:yellow" }, + { "green", S("Green Bed"), "mcl_wool:green", "mcl_dye:dark_green" }, + { "magenta", S("Magenta Bed"), "mcl_wool:magenta", "mcl_dye:magenta" }, + { "orange", S("Orange Bed"), "mcl_wool:orange", "mcl_dye:orange" }, + { "purple", S("Purple Bed"), "mcl_wool:purple", "mcl_dye:violet" }, + { "brown", S("Brown Bed"), "mcl_wool:brown", "mcl_dye:brown" }, + { "pink", S("Pink Bed"), "mcl_wool:pink", "mcl_dye:pink" }, + { "lime", S("Lime Bed"), "mcl_wool:lime", "mcl_dye:green" }, + { "light_blue", S("Light Blue Bed"), "mcl_wool:light_blue", "mcl_dye:lightblue" }, + { "white", S("White Bed"), "mcl_wool:white", "mcl_dye:white" }, } for c=1, #colors do diff --git a/mods/ITEMS/mcl_beds/functions.lua b/mods/ITEMS/mcl_beds/functions.lua index 0f5716098..3a4877a68 100644 --- a/mods/ITEMS/mcl_beds/functions.lua +++ b/mods/ITEMS/mcl_beds/functions.lua @@ -1,3 +1,5 @@ +local S = minetest.get_translator("mcl_beds") + local pi = math.pi local player_in_bed = 0 local is_sp = minetest.is_singleplayer() @@ -67,20 +69,20 @@ local function lay_down(player, pos, bed_pos, state, skip) if bed_pos then -- No sleeping if too far away if vector.distance(bed_pos, pos) > 2 then - minetest.chat_send_player(name, "You can't sleep, the bed's too far away!") + minetest.chat_send_player(name, S("You can't sleep, the bed's too far away!")) return false end for _, other_pos in pairs(mcl_beds.bed_pos) do if vector.distance(bed_pos, other_pos) < 0.1 then - minetest.chat_send_player(name, "This bed is already occupied!") + minetest.chat_send_player(name, S("This bed is already occupied!")) return false end end -- No sleeping while moving. Slightly different behaviour than in MC. if vector.length(player:get_player_velocity()) > 0.001 then - minetest.chat_send_player(name, "You have to stop moving before going to bed!") + minetest.chat_send_player(name, S("You have to stop moving before going to bed!")) return false end @@ -96,7 +98,7 @@ local function lay_down(player, pos, bed_pos, state, skip) -- Approximation of monster detection range if def._cmi_is_mob and ((mobname ~= "mobs_mc:pigman" and def.type == "monster" and not monster_exceptions[mobname]) or (mobname == "mobs_mc:pigman" and ent.state == "attack")) then if math.abs(bed_pos.y - obj:get_pos().y) <= 5 then - minetest.chat_send_player(name, "You can't sleep now, monsters are nearby!") + minetest.chat_send_player(name, S("You can't sleep now, monsters are nearby!")) end return false end @@ -143,10 +145,10 @@ local function lay_down(player, pos, bed_pos, state, skip) local def1 = minetest.registered_nodes[n1.name] local def2 = minetest.registered_nodes[n2.name] if def1.walkable or def2.walkable then - minetest.chat_send_player(name, "You can't sleep, the bed is obstructed!") + minetest.chat_send_player(name, S("You can't sleep, the bed is obstructed!")) return false elseif (def1.damage_per_second ~= nil and def1.damage_per_second > 0) or (def2.damage_per_second ~= nil and def2.damage_per_second > 0) then - minetest.chat_send_player(name, "It's too dangerous to sleep here!") + minetest.chat_send_player(name, S("It's too dangerous to sleep here!")) return false end @@ -162,14 +164,14 @@ local function lay_down(player, pos, bed_pos, state, skip) -- Values taken from Minecraft Wiki with offset of +6000 if tod < 18541 and tod > 5458 and (not weather_mod or (mcl_weather.get_weather() ~= "thunder")) then if spawn_changed then - minetest.chat_send_player(name, "New respawn position set! But you can only sleep at night or during a thunderstorm.") + minetest.chat_send_player(name, S("New respawn position set! But you can only sleep at night or during a thunderstorm.")) else - minetest.chat_send_player(name, "You can only sleep at night or during a thunderstorm.") + minetest.chat_send_player(name, S("You can only sleep at night or during a thunderstorm.")) end return false end if spawn_changed then - minetest.chat_send_player(name, "New respawn position set!") + minetest.chat_send_player(name, S("New respawn position set!")) end mcl_beds.player[name] = 1 diff --git a/mods/ITEMS/mcl_books/init.lua b/mods/ITEMS/mcl_books/init.lua index a2627c77f..2c8d4afc0 100644 --- a/mods/ITEMS/mcl_books/init.lua +++ b/mods/ITEMS/mcl_books/init.lua @@ -1,10 +1,12 @@ +local S =minetest.get_translator("mcl_books") + local max_text_length = 4500 -- TODO: Increase to 12800 when scroll bar was added to written book local max_title_length = 64 -- Book minetest.register_craftitem("mcl_books:book", { - description = "Book", - _doc_items_longdesc = "Books are used to make bookshelves and book and quills.", + description = S("Book"), + _doc_items_longdesc = S("Books are used to make bookshelves and book and quills."), inventory_image = "default_book.png", stack_max = 64, groups = { book=1, craftitem = 1 }, @@ -50,15 +52,15 @@ end local make_description = function(title, author, generation) local desc if generation == 0 then - desc = string.format("“%s”", title) + desc = S("“@1”", title) elseif generation == 1 then - desc = string.format("Copy of “%s”", title) + desc = S("Copy of “@1”", title) elseif generation == 2 then - desc = string.format("Copy of Copy of “%s”", title) + desc = S("Copy of Copy of “@1”", title) else - desc = "Tattered Book" + desc = S("Tattered Book") end - desc = desc .. "\n" .. core.colorize("#AAAAAA", string.format("by %s", author)) + desc = desc .. "\n" .. core.colorize("#AAAAAA", S("by @1", author)) return desc end @@ -81,8 +83,8 @@ local write = function(itemstack, user, pointed_thing) local formspec = "size[8,9]".. "background[-0.5,-0.5;9,10;mcl_books_book_bg.png]".. "textarea[0.75,0.1;7.25,9;text;;"..minetest.formspec_escape(text).."]".. - "button[0.75,7.95;3,1;sign;Sign]".. - "button_exit[4.25,7.95;3,1;ok;Done]" + "button[0.75,7.95;3,1;sign;"..minetest.formspec_escape(S("Sign")).."]".. + "button_exit[4.25,7.95;3,1;ok;"..minetest.formspec_escape(S("Done")).."]" minetest.show_formspec(user:get_player_name(), "mcl_books:writable_book", formspec) end @@ -101,16 +103,16 @@ local read = function(itemstack, user, pointed_thing) local formspec = "size[8,9]".. "background[-0.5,-0.5;9,10;mcl_books_book_bg.png]".. "textarea[0.75,0.1;7.25,9;;"..core.colorize("#000000", minetest.formspec_escape(text))..";]".. - "button_exit[2.25,7.95;3,1;ok;Done]" + "button_exit[2.25,7.95;3,1;ok;"..minetest.formspec_escape(S("Done")).."]" minetest.show_formspec(user:get_player_name(), "mcl_books:written_book", formspec) end -- Book and Quill minetest.register_craftitem("mcl_books:writable_book", { description = "Book and Quill", - _doc_items_longdesc = "This item can be used to write down some notes.", - _doc_items_usagehelp = "Hold it in the hand, then rightclick to read the current notes and edit then. You can edit the text as often as you like. You can also sign the book which turns it into a written book which you can stack, but it can't be edited anymore.".."\n".. - "A book can hold up to 4500 characters. The title length is limited to 64 characters.", + _doc_items_longdesc = S("This item can be used to write down some notes."), + _doc_items_usagehelp = S("Hold it in the hand, then rightclick to read the current notes and edit then. You can edit the text as often as you like. You can also sign the book which turns it into a written book which you can stack, but it can't be edited anymore.").."\n".. + S("A book can hold up to 4500 characters. The title length is limited to 64 characters."), inventory_image = "mcl_books_book_writable.png", groups = { book=1 }, stack_max = 1, @@ -134,11 +136,11 @@ minetest.register_on_player_receive_fields(function ( player, formname, fields ) local name = player:get_player_name() local formspec = "size[8,9]".. "background[-0.5,-0.5;9,10;mcl_books_book_bg.png]".. - "field[0.75,1;7.25,1;title;"..core.colorize("#000000", "Enter book title:")..";]".. - "label[0.75,1.5;"..core.colorize("#404040", minetest.formspec_escape("by " .. name)).."]".. - "label[0.75,6.95;"..core.colorize("#000000", "Note: The book will no longer") .. "\n" .. core.colorize("#000000", "be editable after signing.").."]".. - "button_exit[0.75,7.95;3,1;sign;Sign and Close]".. - "button[4.25,7.95;3,1;cancel;Cancel]" + "field[0.75,1;7.25,1;title;"..core.colorize("#000000", S("Enter book title:"))..";]".. + "label[0.75,1.5;"..core.colorize("#404040", minetest.formspec_escape(S("by @1", name))).."]".. + "label[0.75,6.95;"..core.colorize("#000000", minetest.formspec_escape(S("Note: The book will no longer\nbe editable after signing."))).."]".. + "button_exit[0.75,7.95;3,1;sign;"..minetest.formspec_escape(S("Sign and Close")).."]".. + "button[4.25,7.95;3,1;cancel;"..minetest.formspec_escape(S("Cancel")).."]" minetest.show_formspec(player:get_player_name(), "mcl_books:signing", formspec) end end @@ -149,7 +151,7 @@ minetest.register_on_player_receive_fields(function ( player, formname, fields ) if book:get_name() == "mcl_books:writable_book" then local title = fields.title if string.len(title) == 0 then - title = "Nameless Book" + title = S("Nameless Book") end title = cap_text_length(title, max_title_length) local meta = newbook:get_meta() @@ -184,11 +186,11 @@ end -- Written Book minetest.register_craftitem("mcl_books:written_book", { - description = "Written Book", - _doc_items_longdesc = "Written books contain some text written by someone. They can be read and copied, but not edited.", - _doc_items_usagehelp = [[Hold it in your hand, then rightclick to read the book. + description = S("Written Book"), + _doc_items_longdesc = S("Written books contain some text written by someone. They can be read and copied, but not edited."), + _doc_items_usagehelp = S("Hold it in your hand, then rightclick to read the book.").."\n\n".. -To copy the text of the written book, place it into the crafting grid together with a book and quill (or multiple of those) and craft. The written book will not be consumed. Copies of copies can not be copied.]], +S("To copy the text of the written book, place it into the crafting grid together with a book and quill (or multiple of those) and craft. The written book will not be consumed. Copies of copies can not be copied."), inventory_image = "mcl_books_book_written.png", groups = { not_in_creative_inventory=1, book=1, no_rename=1 }, stack_max = 16, @@ -322,8 +324,8 @@ end -- Bookshelf minetest.register_node("mcl_books:bookshelf", { - description = "Bookshelf", - _doc_items_longdesc = "Bookshelves are used for decoration.", + description = S("Bookshelf"), + _doc_items_longdesc = S("Bookshelves are used for decoration."), tiles = {"mcl_books_bookshelf_top.png", "mcl_books_bookshelf_top.png", "default_bookshelf.png"}, stack_max = 64, is_ground_content = false, diff --git a/mods/ITEMS/mcl_bows/arrow.lua b/mods/ITEMS/mcl_bows/arrow.lua index a3c8fb4a1..9561fea0d 100644 --- a/mods/ITEMS/mcl_bows/arrow.lua +++ b/mods/ITEMS/mcl_bows/arrow.lua @@ -1,3 +1,5 @@ +local S = minetest.get_translator("mcl_bows") + -- Time in seconds after which a stuck arrow is deleted local ARROW_TIMEOUT = 60 -- Time after which stuck arrow is rechecked for being stuck @@ -11,11 +13,11 @@ local mod_awards = minetest.get_modpath("awards") and minetest.get_modpath("mcl_ local mod_button = minetest.get_modpath("mesecons_button") minetest.register_craftitem("mcl_bows:arrow", { - description = "Arrow", - _doc_items_longdesc = [[Arrows are ammunition for bows and dispensers. -An arrow fired from a bow has a regular damage of 1-9. At full charge, there's a 20% chance of a critical hit dealing 10 damage instead. An arrow fired from a dispenser always deals 3 damage. -Arrows might get stuck on solid blocks and can be retrieved again. They are also capable of pushing wooden buttons.]], - _doc_items_usagehelp = "To use arrows as ammunition for a bow, just put them anywhere in your inventory, they will be used up automatically. To use arrows as ammunition for a dispenser, place them in the dispenser's inventory. To retrieve an arrow that sticks in a block, simply walk close to it.", + description = S("Arrow"), + _doc_items_longdesc = S("Arrows are ammunition for bows and dispensers.").."\n".. +S("An arrow fired from a bow has a regular damage of 1-9. At full charge, there's a 20% chance of a critical hit dealing 10 damage instead. An arrow fired from a dispenser always deals 3 damage.").."\n".. +S("Arrows might get stuck on solid blocks and can be retrieved again. They are also capable of pushing wooden buttons."), + _doc_items_usagehelp = S("To use arrows as ammunition for a bow, just put them anywhere in your inventory, they will be used up automatically. To use arrows as ammunition for a dispenser, place them in the dispenser's inventory. To retrieve an arrow that sticks in a block, simply walk close to it."), inventory_image = "mcl_bows_arrow_inv.png", groups = { ammo=1, ammo_bow=1 }, _on_dispense = function(itemstack, dispenserpos, droppos, dropnode, dropdir) diff --git a/mods/ITEMS/mcl_bows/bow.lua b/mods/ITEMS/mcl_bows/bow.lua index 14cea6a74..543c573d5 100644 --- a/mods/ITEMS/mcl_bows/bow.lua +++ b/mods/ITEMS/mcl_bows/bow.lua @@ -1,3 +1,5 @@ +local S = minetest.get_translator("mcl_bows") + mcl_bows = {} local arrows = { @@ -95,10 +97,10 @@ end -- Bow item, uncharged state minetest.register_tool("mcl_bows:bow", { - description = "Bow", - _doc_items_longdesc = [[Bows are ranged weapons to shoot arrows at your foes. -The speed and damage of the arrow increases the longer you charge. The regular damage of the arrow is between 1 and 9. At full charge, there's also a 20% of a critical hit, dealing 10 damage instead.]], - _doc_items_usagehelp = [[To use the bow, you first need to have at least one arrow anywhere in your inventory (unless in Creative Mode). Hold down the right mouse button to charge, release to shoot.]], + description = S("Bow"), + _doc_items_longdesc = S("Bows are ranged weapons to shoot arrows at your foes.").."\n".. +S("The speed and damage of the arrow increases the longer you charge. The regular damage of the arrow is between 1 and 9. At full charge, there's also a 20% of a critical hit, dealing 10 damage instead."), + _doc_items_usagehelp = S("To use the bow, you first need to have at least one arrow anywhere in your inventory (unless in Creative Mode). Hold down the right mouse button to charge, release to shoot."), _doc_items_durability = BOW_DURABILITY, inventory_image = "mcl_bows_bow.png", stack_max = 1, @@ -138,7 +140,7 @@ end -- Bow in charging state for level=0, 2 do minetest.register_tool("mcl_bows:bow_"..level, { - description = "Bow", + description = S("Bow"), _doc_items_create_entry = false, inventory_image = "mcl_bows_bow_"..level..".png", stack_max = 1,