1
0
mirror of https://gitlab.com/echoes91/spears.git synced 2024-11-13 13:20:19 +01:00

Add translation support

This commit is contained in:
Jaidyn Ann 2024-01-03 15:13:14 -06:00 committed by Jaidyn Ann
parent 5ac99ff835
commit f9e839435c
2 changed files with 23 additions and 12 deletions

9
locale/template.txt Normal file
View File

@ -0,0 +1,9 @@
# textdomain: spears
Stone Spear=
Iron Spear=
Steel Spear=
Copper Spear=
Bronze Spear=
Obsidian Spear=
Diamond Spear=
Golden Spear=

View File

@ -1,7 +1,9 @@
local S = minetest.get_translator("spears")
function spears_register_spear(spear_type, desc, base_damage, toughness, material)
minetest.register_tool("spears:spear_" .. spear_type, {
description = desc .. " spear",
description = desc,
wield_image = "spears_spear_" .. spear_type .. ".png^[transform4",
inventory_image = "spears_spear_" .. spear_type .. ".png",
wield_scale= {x = 1.5, y = 1.5, z = 1.5},
@ -55,43 +57,43 @@ function spears_register_spear(spear_type, desc, base_damage, toughness, materia
end
if not DISABLE_STONE_SPEAR then
spears_register_spear('stone', 'Stone', 4, 20, 'group:stone')
spears_register_spear('stone', S('Stone Spear'), 4, 20, 'group:stone')
end
if minetest.get_modpath("pigiron") then
if not DISABLE_IRON_SPEAR then
spears_register_spear('iron', 'Iron', 5.5, 30, 'pigiron:iron_ingot')
spears_register_spear('iron', S('Iron Spear'), 5.5, 30, 'pigiron:iron_ingot')
end
if not DISABLE_STEEL_SPEAR then
spears_register_spear('steel', 'Steel', 6, 35, 'default:steel_ingot')
spears_register_spear('steel', S('Steel Spear'), 6, 35, 'default:steel_ingot')
end
if not DISABLE_COPPER_SPEAR then
spears_register_spear('copper', 'Copper', 4.8, 30, 'default:copper_ingot')
spears_register_spear('copper', S('Copper Spear'), 4.8, 30, 'default:copper_ingot')
end
if not DISABLE_BRONZE_SPEAR then
spears_register_spear('bronze', 'Bronze', 5.5, 35, 'default:bronze_ingot')
spears_register_spear('bronze', S('Bronze Spear'), 5.5, 35, 'default:bronze_ingot')
end
else
if not DISABLE_STEEL_SPEAR then
spears_register_spear('steel', 'Steel', 6, 30, 'default:steel_ingot')
spears_register_spear('steel', S('Steel Spear'), 6, 30, 'default:steel_ingot')
end
if not DISABLE_COPPER_SPEAR then
spears_register_spear('copper', 'Copper', 5, 30, 'default:copper_ingot')
spears_register_spear('copper', S('Copper Spear'), 5, 30, 'default:copper_ingot')
end
if not DISABLE_BRONZE_SPEAR then
spears_register_spear('bronze', 'Bronze', 6, 35, 'default:bronze_ingot')
spears_register_spear('bronze', S('Bronze Spear'), 6, 35, 'default:bronze_ingot')
end
end
if not DISABLE_OBSIDIAN_SPEAR then
spears_register_spear('obsidian', 'Obsidian', 8, 30, 'default:obsidian')
spears_register_spear('obsidian', S('Obsidian Spear'), 8, 30, 'default:obsidian')
end
if not DISABLE_DIAMOND_SPEAR then
spears_register_spear('diamond', 'Diamond', 8, 40, 'default:diamond')
spears_register_spear('diamond', S('Diamond Spear'), 8, 40, 'default:diamond')
end
if not DISABLE_GOLD_SPEAR then
spears_register_spear('gold', 'Golden', 5, 40, 'default:gold_ingot')
spears_register_spear('gold', S('Golden Spear'), 5, 40, 'default:gold_ingot')
end