Add localization support using Minetest's built-in translator...

Breaks compatibility with Minetest 0.4.
This commit is contained in:
Jordan Irwin 2021-07-27 14:32:08 -07:00
parent 74bcd7ea09
commit 511b09c29b
5 changed files with 45 additions and 14 deletions

@ -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,

16
locale/template.txt Normal file

@ -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=

@ -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

@ -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,

@ -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,