From 93e34d1d0310ac8e24bef10917b4e57621f9f7f8 Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Fri, 15 Mar 2019 02:05:10 +0100 Subject: [PATCH] Make mcl_colorblocks translatable --- mods/ITEMS/mcl_colorblocks/init.lua | 62 +++++++++++++++-------------- 1 file changed, 33 insertions(+), 29 deletions(-) diff --git a/mods/ITEMS/mcl_colorblocks/init.lua b/mods/ITEMS/mcl_colorblocks/init.lua index 8a3f971d..a4471fe4 100644 --- a/mods/ITEMS/mcl_colorblocks/init.lua +++ b/mods/ITEMS/mcl_colorblocks/init.lua @@ -1,34 +1,35 @@ local init = os.clock() +local S = minetest.get_translator("mcl_colorblocks") local block = {} block.dyes = { - {"white", "White", "white"}, - {"grey", "Grey", "dark_grey"}, - {"silver", "Light Grey", "grey"}, - {"black", "Black", "black"}, - {"red", "Red", "red"}, - {"yellow", "Yellow", "yellow"}, - {"green", "Green", "dark_green"}, - {"cyan", "Cyan", "cyan"}, - {"blue", "Blue", "blue"}, - {"magenta", "Magenta", "magenta"}, - {"orange", "Orange", "orange"}, - {"purple", "Purple", "violet"}, - {"brown", "Brown", "brown"}, - {"pink", "Pink", "pink"}, - {"lime", "Lime", "green"}, - {"light_blue", "Light Blue", "lightblue"}, + {"white", S("White Terracotta"), S("White Glazed Terracotta"), S("White Concrete Powder"), S("White Concrete"), "white"}, + {"grey", S("Grey Terracotta"), S("Grey Glazed Terracotta"), S("Grey Concrete Powder"), S("Grey Concrete"), "dark_grey"}, + {"silver", S("Light Grey Terracotta"), S("Light Grey Glazed Terracotta"), S("Light Grey Concrete Powder"), S("Light Grey Concrete"), "grey"}, + {"black", S("Black Terracotta"), S("Black Glazed Terracotta"), S("Black Concrete Powder"), S("Black Concrete"), "black"}, + {"red", S("Red Terracotta"), S("Red Glazed Terracotta"), S("Red Concrete Powder"), S("Red Concrete"), "red"}, + {"yellow", S("Yellow Terracotta"), S("Yellow Glazed Terracotta"), S("Yellow Concrete Powder"), S("Yellow Concrete"), "yellow"}, + {"green", S("Green Terracotta"), S("Green Glazed Terracotta"), S("Green Concrete Powder"), S("Green Concrete"), "dark_green"}, + {"cyan", S("Cyan Terracotta"), S("Cyan Glazed Terracotta"), S("Cyan Concrete Powder"), S("Cyan Concrete"), "cyan"}, + {"blue", S("Blue Terracotta"), S("Blue Glazed Terracotta"), S("Blue Concrete Powder"), S("Blue Concrete"), "blue"}, + {"magenta", S("Magenta Terracotta"), S("Magenta Glazed Terracotta"), S("Magenta Concrete Powder"), S("Magenta Concrete"), "magenta"}, + {"orange", S("Orange Terracotta"), S("Orange Glazed Terracotta"), S("Orange Concrete Powder"), S("Orange Concrete"), "orange"}, + {"purple", S("Purple Terracotta"), S("Purple Glazed Terracotta"), S("Purple Concrete Powder"), S("Purple Concrete"), "violet"}, + {"brown", S("Brown Terracotta"), S("Brown Glazed Terracotta"), S("Brown Concrete Powder"), S("Brown Concrete"), "brown"}, + {"pink", S("Pink Terracotta"), S("Pink Glazed Terracotta"), S("Pink Concrete Powder"), S("Pink Concrete"), "pink"}, + {"lime", S("Lime Terracotta"), S("Lime Glazed Terracotta"), S("Lime Concrete Powder"), S("Lime Concrete"), "green"}, + {"light_blue", S("Light Blue Terracotta"), S("Light Blue Glazed Terracotta"), S("Light Blue Concrete Powder"), S("Light Blue Concrete"), "lightblue"}, } -local hc_desc = "Terracotta is a basic building material. It comes in many different colors." -local gt_desc = "Glazed terracotta is a decorative block with a complex pattern. It can be rotated by placing it in different directions." -local cp_desc = "Concrete powder is used for creating concrete, but it can also be used as decoration itself. It comes in different colors. Concrete powder turns into concrete of the same color when it comes in contact with water." -local conc_desc = "Concrete is a decorative block which comes in many different colors. It is notable for having a very strong and clean color.", +local hc_desc = S("Terracotta is a basic building material. It comes in many different colors.") +local gt_desc = S("Glazed terracotta is a decorative block with a complex pattern. It can be rotated by placing it in different directions.") +local cp_desc = S("Concrete powder is used for creating concrete, but it can also be used as decoration itself. It comes in different colors. Concrete powder turns into concrete of the same color when it comes in contact with water.") +local c_desc = S("Concrete is a decorative block which comes in many different colors. It is notable for having a very strong and clean color.") minetest.register_node("mcl_colorblocks:hardened_clay", { - description = "Terracotta", - _doc_items_longdesc = "Terracotta is a basic building material.", + description = S("Terracotta"), + _doc_items_longdesc = S("Terracotta is a basic building material which comes in many different colors. This particular block is uncolored."), tiles = {"hardened_clay.png"}, stack_max = 64, groups = {pickaxey=1, hardened_clay=1,building_block=1, material_stone=1}, @@ -51,11 +52,14 @@ end for _, row in ipairs(block.dyes) do local name = row[1] - local desc = row[2] - local craft_color_group = row[3] + local sdesc_hc = row[2] + local sdesc_gt = row[3] + local sdesc_cp = row[4] + local sdesc_c = row[5] + local craft_color_group = row[6] -- Node Definition minetest.register_node("mcl_colorblocks:hardened_clay_"..name, { - description = desc.." Terracotta", + description = sdesc_hc, _doc_items_longdesc = hc_desc, tiles = {"hardened_clay_stained_"..name..".png"}, groups = {pickaxey=1, hardened_clay=1,building_block=1, material_stone=1}, @@ -66,7 +70,7 @@ for _, row in ipairs(block.dyes) do }) minetest.register_node("mcl_colorblocks:concrete_powder_"..name, { - description = desc.." Concrete Powder", + description = sdesc_cp, _doc_items_longdesc = cp_desc, tiles = {"mcl_colorblocks_concrete_powder_"..name..".png"}, groups = {handy=1,shovely=1, concrete_powder=1,building_block=1,falling_node=1, material_sand=1}, @@ -104,8 +108,8 @@ for _, row in ipairs(block.dyes) do }) minetest.register_node("mcl_colorblocks:concrete_"..name, { - description = desc.." Concrete", - _doc_items_longdesc = conc_desc, + description = sdesc_c, + _doc_items_longdesc = c_desc, tiles = {"mcl_colorblocks_concrete_"..name..".png"}, groups = {handy=1,pickaxey=1, concrete=1,building_block=1, material_stone=1}, stack_max = 64, @@ -118,7 +122,7 @@ for _, row in ipairs(block.dyes) do local tex = "mcl_colorblocks_glazed_terracotta_"..name..".png" local texes = { tex, tex, tex.."^[transformR180", tex, tex.."^[transformR270", tex.."^[transformR90" } minetest.register_node("mcl_colorblocks:glazed_terracotta_"..name, { - description = desc.." Glazed Terracotta", + description = sdesc_gt, _doc_items_longdesc = gt_desc, tiles = texes, groups = {handy=1,pickaxey=1, glazed_terracotta=1,building_block=1, material_stone=1},