summaryrefslogtreecommitdiff
path: root/init.lua
diff options
context:
space:
mode:
Diffstat (limited to 'init.lua')
-rw-r--r--init.lua79
1 files changed, 44 insertions, 35 deletions
diff --git a/init.lua b/init.lua
index 22d9cfe..e7a8b0c 100644
--- a/init.lua
+++ b/init.lua
@@ -1,30 +1,39 @@
+-- Boilerplate to support localized strings if intllib mod is installed.
+local S
+if minetest.get_modpath("intllib") then
+ dofile(minetest.get_modpath("intllib").."/intllib.lua")
+ S = intllib.Getter(minetest.get_current_modname())
+else
+ S = function(s) return s end
+end
+
local groupdefs = {
- ["book"] = "Books",
- ["vessel"] = "Vessels",
- ["dye"] = "Dyes",
- ["stick"] = "Sticks",
- ["wool"] = "Wool",
- ["sand"] = "Sand",
- ["wood"] = "Wood",
- ["stone"] = "Stones",
- ["metal"] = "Metal",
- ["tree"] = "Tree Trunks",
- ["fence"] = "Fences",
- ["wall"] = "Walls",
- ["leaves"] = "Leaves and Needles",
- ["flower"] = "Flowers",
- ["sapling"] = "Saplings",
- ["water"] = "Water",
- ["lava"] = "Lava",
-
- ["cracky"] = "Cracky",
- ["crumbly"] = "Crumbly",
- ["choppy"] = "Choppy",
- ["snappy"] = "Snappy",
- ["bendy"] = "Bendy",
- ["oddly_breakable_by_hand"] = "Hand-breakable",
-
- ["fleshy"] = "Flesh",
+ ["book"] = S("Books"),
+ ["vessel"] = S("Vessels"),
+ ["dye"] = S("Dyes"),
+ ["stick"] = S("Sticks"),
+ ["wool"] = S("Wool"),
+ ["sand"] = S("Sand"),
+ ["wood"] = S("Wood"),
+ ["stone"] = S("Stones"),
+ ["metal"] = S("Metal"),
+ ["tree"] = S("Tree Trunks"),
+ ["fence"] = S("Fences"),
+ ["wall"] = S("Walls"),
+ ["leaves"] = S("Leaves and Needles"),
+ ["flower"] = S("Flowers"),
+ ["sapling"] = S("Saplings"),
+ ["water"] = S("Water"),
+ ["lava"] = S("Lava"),
+
+ ["cracky"] = S("Cracky"),
+ ["crumbly"] = S("Crumbly"),
+ ["choppy"] = S("Choppy"),
+ ["snappy"] = S("Snappy"),
+ ["bendy"] = S("Bendy"),
+ ["oddly_breakable_by_hand"] = S("Hand-breakable"),
+
+ ["fleshy"] = S("Flesh"),
}
local miscgroups = { "book", "vessel", "dye", "stick", "wool", "sand", "wood", "stone", "metal", "tree", "fence", "wall", "leaves", "flower", "sapling", "water", "lava" }
@@ -121,21 +130,21 @@ local function f_fire(itemstring, def)
-- Fire
if def.groups.flammable ~= nil then
-- TODO: When the fire mod supports different flammable levels, add flavor texts
- s = s .. "This block is flammable."
+ s = s .. S("This block is flammable.")
end
if def.groups.puts_out_fire ~= nil then
if def.groups.flammable ~= nil then
s = s .. "\n"
end
- s = s .. "This block will extinguish nearby fire."
+ s = s .. S("This block will extinguish nearby fire.")
end
if def.groups.igniter ~= nil then
if def.groups.flammable ~= nil or def.groups.puts_out_fire ~= nil then
s = s .. "\n"
end
- s = s .. "This block will set flammable blocks within a radius of "..def.groups.igniter.." on fire."
+ s = s .. string.format(S("This block will set flammable blocks within a radius of %d on fire."), def.groups.igniter)
end
return s
end
@@ -143,7 +152,7 @@ end
-- flora group
local function f_flora(itemstring, def)
if def.groups.flora == 1 then
- return "This block belongs to the Flora group. It a living organism which likes to grow and spread on dirt with grass or dirt with dry grass when it is in light. Spreading will stop when the surrounding area is too crammed with Flora blocks. On desert sand, it will wither and die and turn into a dry shrub."
+ return S("This block belongs to the Flora group. It a living organism which likes to grow and spread on dirt with grass or dirt with dry grass when it is in light. Spreading will stop when the surrounding area is too crammed with Flora blocks. On desert sand, it will wither and die and turn into a dry shrub.")
else
return ""
end
@@ -152,9 +161,9 @@ end
-- soil group
local function f_soil(itemstring, def)
if def.groups.soil == 1 then
- return "This block is natural soil. It supports the growth of blocks belonging to the Saplings group."
+ return S("This block is natural soil. It supports the growth of blocks belonging to the Saplings group.")
elseif def.groups.soil == 2 or def.groups.soil == 3 then
- return "This block serves as a soil for saplings as well as plants grown from seeds. It supports their growth."
+ return S("This block serves as a soil for saplings as well as plants grown from seeds. It supports their growth.")
else
return ""
end
@@ -164,12 +173,12 @@ local function f_leafdecay(itemstring, def)
local formstring = ""
if def.groups.leafdecay ~= nil then
if def.groups.leafdecay_drop ~= nil then
- formstring = string.format("This block may drop as an item when no trunk is nearby. This is prevented if any block of the group “Tree Trunks” is nearby (up to a distance of %d), the block is completely surrounded by blocks which are neither air or a liquid or it has been manually placed by a player.", def.groups.leafdecay)
+ formstring = string.format(S("This block may drop as an item when no trunk is nearby. This is prevented if any block of the group “Tree Trunks” is nearby (up to a distance of %d), the block is completely surrounded by blocks which are neither air or a liquid or it has been manually placed by a player."), def.groups.leafdecay)
else
if def.drop ~= "" and def.drop ~= nil and def.drop ~= itemstring then
- formstring = string.format("This block may decay when no trunk is nearby. When decaying, it disappears and may drop one of its mining drops (but never itself). Decay is prevented if any block of the group “Tree Trunks” is nearby (up to a distance of %d), the block is completely surrounded by blocks which are neither air or a liquid or it has been placed by a player.", def.groups.leafdecay)
+ formstring = string.format(S("This block may decay when no trunk is nearby. When decaying, it disappears and may drop one of its mining drops (but never itself). Decay is prevented if any block of the group “Tree Trunks” is nearby (up to a distance of %d), the block is completely surrounded by blocks which are neither air or a liquid or it has been placed by a player."), def.groups.leafdecay)
else
- formstring = string.format("This block may decay and disappear when no trunk is nearby. Decay is prevented if any block of the group “Tree Trunks” is nearby (up to a distance of %d), the block is completely surrounded by blocks which are neither air or a liquid or it has been placed by a player.", def.groups.leafdecay)
+ formstring = string.format(S("This block may decay and disappear when no trunk is nearby. Decay is prevented if any block of the group “Tree Trunks” is nearby (up to a distance of %d), the block is completely surrounded by blocks which are neither air or a liquid or it has been placed by a player."), def.groups.leafdecay)
end
end
end