From 74bcd7ea09ec45b5e449fd3ba44d49c626aafc3f Mon Sep 17 00:00:00 2001 From: Jordan Irwin Date: Tue, 27 Jul 2021 14:30:16 -0700 Subject: [PATCH 1/4] Add mod.conf --- mod.conf | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 mod.conf diff --git a/mod.conf b/mod.conf new file mode 100644 index 0000000..8a64b1c --- /dev/null +++ b/mod.conf @@ -0,0 +1,8 @@ +name = rainbow_ore +title = Rainbow Ore +description = Rainbow materials & equipment. +author = Robin Kuhn (KingSmarty) +license = LGPL +min_minetest_version = 0.4.16 +depends = default +optional_depends = 3d_armor, shields From 511b09c29b14e3703baa4d050c02be9293d72445 Mon Sep 17 00:00:00 2001 From: Jordan Irwin Date: Tue, 27 Jul 2021 14:32:08 -0700 Subject: [PATCH 2/4] Add localization support using Minetest's built-in translator... Breaks compatibility with Minetest 0.4. --- init.lua | 23 +++++++++++++++-------- locale/template.txt | 16 ++++++++++++++++ mod.conf | 2 +- rainbow_armor.lua | 12 ++++++++---- rainbow_shield.lua | 6 +++++- 5 files changed, 45 insertions(+), 14 deletions(-) create mode 100644 locale/template.txt diff --git a/init.lua b/init.lua index cdd7013..aec80b9 100644 --- a/init.lua +++ b/init.lua @@ -1,17 +1,24 @@ -- Rainbow_Ore Test Mod ----------- Copyright Robin Kuhn 2015 +rainbow_ore = {} +rainbow_ore.modname = minetest.get_current_modname() +rainbow_ore.modpath = minetest.get_modpath(rainbow_ore.modname) + --Check for mods if minetest.get_modpath("3d_armor") then -dofile(minetest.get_modpath("rainbow_ore").."/rainbow_armor.lua") +dofile(rainbow_ore.modpath.."/rainbow_armor.lua") end if minetest.get_modpath("shields") then -dofile(minetest.get_modpath("rainbow_ore").."/rainbow_shield.lua") +dofile(rainbow_ore.modpath.."/rainbow_shield.lua") end + +local S = minetest.get_translator(rainbow_ore.modname) + -- Define Rainbow_Ore_Block node minetest.register_node("rainbow_ore:rainbow_ore_block", { - description = "Rainbow Ore", + description = S("Rainbow Ore"), tiles = {"rainbow_ore_block.png"}, groups = {stone=2, cracky=3}, drop = "rainbow_ore:rainbow_ore_block", @@ -21,7 +28,7 @@ minetest.register_node("rainbow_ore:rainbow_ore_block", { --Define Rainbow_Ore_Ingot node minetest.register_craftitem("rainbow_ore:rainbow_ore_ingot", { - description = "Rainbow Ore Ingot", + description = S("Rainbow Ore Ingot"), inventory_image = "rainbow_ore_ingot.png", }) @@ -36,7 +43,7 @@ minetest.register_craft({ --Register Rainbow Pickaxe minetest.register_tool("rainbow_ore:rainbow_ore_pickaxe", { - description = "Rainbow Pickaxe", + description = S("Rainbow Pickaxe"), inventory_image = "rainbow_ore_pickaxe.png", tool_capabilities = { full_punch_interval = 0.9, @@ -62,7 +69,7 @@ minetest.register_craft({ --Register Rainbow Axe minetest.register_tool("rainbow_ore:rainbow_ore_axe", { - description = "Rainbow Axe", + description = S("Rainbow Axe"), inventory_image = "rainbow_ore_axe.png", tool_capabilities = { full_punch_interval = 0.9, @@ -97,7 +104,7 @@ minetest.register_craft({ --Register Rainbow shovel minetest.register_tool("rainbow_ore:rainbow_ore_shovel", { - description = "Rainbow Shovel", + description = S("Rainbow Shovel"), inventory_image = "rainbow_ore_shovel.png", wield_image = "rainbow_ore_shovel.png^[transformR90", tool_capabilities = { @@ -124,7 +131,7 @@ minetest.register_craft({ --Register Rainbow sword minetest.register_tool("rainbow_ore:rainbow_ore_sword", { - description = "Rainbow Sword", + description = S("Rainbow Sword"), inventory_image = "rainbow_ore_sword.png", tool_capabilities = { full_punch_interval = 0.7, diff --git a/locale/template.txt b/locale/template.txt new file mode 100644 index 0000000..7c8959b --- /dev/null +++ b/locale/template.txt @@ -0,0 +1,16 @@ +# textdomain:rainbow_ore + +# Translators: + + +Rainbow Ore= +Rainbow Ore Ingot= +Rainbow Pickaxe= +Rainbow Axe= +Rainbow Shovel= +Rainbow Sword= +Rainbow Helmet= +Rainbow Chestplate= +Rainbow Leggings= +Rainbow Boots= +Rainbow Shield= diff --git a/mod.conf b/mod.conf index 8a64b1c..d7070fc 100644 --- a/mod.conf +++ b/mod.conf @@ -3,6 +3,6 @@ title = Rainbow Ore description = Rainbow materials & equipment. author = Robin Kuhn (KingSmarty) license = LGPL -min_minetest_version = 0.4.16 +min_minetest_version = 5.0 depends = default optional_depends = 3d_armor, shields diff --git a/rainbow_armor.lua b/rainbow_armor.lua index b02dc39..02882e6 100644 --- a/rainbow_armor.lua +++ b/rainbow_armor.lua @@ -1,24 +1,28 @@ + +local S = minetest.get_translator(rainbow_ore.modname) + + --Define Rainbow Armor minetest.register_tool("rainbow_ore:rainbow_ore_helmet", { - description = "Rainbow Helmet", + description = S("Rainbow Helmet"), inventory_image = "rainbow_ore_helmet_inv.png", groups = {armor_head=20, armor_heal=17, armor_use=40}, wear = 0, }) minetest.register_tool("rainbow_ore:rainbow_ore_chestplate", { - description = "Rainbow Chestplate", + description = S("Rainbow Chestplate"), inventory_image = "rainbow_ore_chestplate_inv.png", groups = {armor_torso=25, armor_heal=17, armor_use=40}, wear = 0, }) minetest.register_tool("rainbow_ore:rainbow_ore_leggings", { - description = "Rainbow Leggings", + description = S("Rainbow Leggings"), inventory_image = "rainbow_ore_leggings_inv.png", groups = {armor_legs=25, armor_heal=17, armor_use=40}, wear = 0, }) minetest.register_tool("rainbow_ore:rainbow_ore_boots", { - description = "Rainbow Boots", + description = S("Rainbow Boots"), inventory_image = "rainbow_ore_boots_inv.png", groups = {armor_feet=20, armor_heal=17, armor_use=40}, wear = 0, diff --git a/rainbow_shield.lua b/rainbow_shield.lua index 0c1a0bd..11c8201 100644 --- a/rainbow_shield.lua +++ b/rainbow_shield.lua @@ -1,6 +1,10 @@ + +local S = minetest.get_translator(rainbow_ore.modname) + + --Define Rainbow shield minetest.register_tool("rainbow_ore:rainbow_ore_shield", { - description = "Rainbow Shield", + description = S("Rainbow Shield"), inventory_image = "rainbow_ore_shield_inv.png", groups = {armor_shield=20, armor_heal=17, armor_use=40, armor_fire=1}, wear = 0, From 3e6e96a8d8ae506b820e0c607688a6466a9170d8 Mon Sep 17 00:00:00 2001 From: Jordan Irwin Date: Tue, 27 Jul 2021 15:06:10 -0700 Subject: [PATCH 3/4] Remove deprecated depends.txt file --- depends.txt | 3 --- 1 file changed, 3 deletions(-) delete mode 100644 depends.txt diff --git a/depends.txt b/depends.txt deleted file mode 100644 index 447e1a1..0000000 --- a/depends.txt +++ /dev/null @@ -1,3 +0,0 @@ -default -3d_armor? -shields? \ No newline at end of file From cc7009b0227b2493f17f138da0d01dbe92933457 Mon Sep 17 00:00:00 2001 From: Jordan Irwin Date: Tue, 27 Jul 2021 15:06:39 -0700 Subject: [PATCH 4/4] Add Spanish translation --- locale/rainbow_ore.es.tr | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 locale/rainbow_ore.es.tr diff --git a/locale/rainbow_ore.es.tr b/locale/rainbow_ore.es.tr new file mode 100644 index 0000000..69e0735 --- /dev/null +++ b/locale/rainbow_ore.es.tr @@ -0,0 +1,16 @@ +# textdomain:rainbow_ore + +# Translators: Jordan Irwin (AntumDeluge) + + +Rainbow Ore=Mineral de Arcoíris +Rainbow Ore Ingot=Lingote de Arcoíris +Rainbow Pickaxe=Pico de Arcoíris +Rainbow Axe=Hacha de Arcoíris +Rainbow Shovel=Pala de Arcoíris +Rainbow Sword=Espada de Arcoíris +Rainbow Helmet=Casco de Arcoíris +Rainbow Chestplate=Pechera de Arcoíris +Rainbow Leggings=Esquinela de Arcoíris +Rainbow Boots=Botas de Arcoíris +Rainbow Shield=Escudo de Arcoíris