summaryrefslogtreecommitdiff
path: root/init.lua
diff options
context:
space:
mode:
authorxisd <zlexis.dnl@googlemail.com>2016-10-18 18:13:59 +0200
committerAuke Kok <sofar+github@foo-projects.org>2016-10-18 09:13:59 -0700
commite6421d8d495c4415eeae80c7b1a2ce20d55e443d (patch)
tree1f2c38e7e72f7bd5dbd04888d7bc758d007326af /init.lua
parent65729b9d33fde507a4044b25cd29fba2d8a5eb50 (diff)
Intllib (#5)
Support for translation via intllib.
Diffstat (limited to 'init.lua')
-rw-r--r--init.lua18
1 files changed, 14 insertions, 4 deletions
diff --git a/init.lua b/init.lua
index 7bd3024..764db29 100644
--- a/init.lua
+++ b/init.lua
@@ -58,6 +58,16 @@ settings.difficult = {
hydration = true,
}
+
+-- Intllib
+local S
+if minetest.get_modpath("intllib") then
+ S = intllib.Getter()
+else
+ S = function(s) return s end
+end
+crops.intllib = S
+
local worldpath = minetest.get_worldpath()
local modpath = minetest.get_modpath(minetest.get_current_modname())
@@ -82,15 +92,15 @@ end
if not crops.difficulty then
crops.difficulty = "normal"
- minetest.log("error", "Defaulting to \"normal\" difficulty settings")
+ minetest.log("error", S("Defaulting to \"normal\" difficulty settings"))
end
crops.settings = settings[crops.difficulty]
if not crops.settings then
- minetest.log("error", "Defaulting to \"normal\" difficulty settings")
+ minetest.log("error", S("Defaulting to \"normal\" difficulty settings"))
crops.settings = settings.normal
end
if crops.settings.hydration then
- minetest.log("action", "[crops] Hydration and dehydration mechanics are enabled.")
+ minetest.log("action", S("[crops] Hydration and dehydration mechanics are enabled."))
end
local find_plant = function(node)
@@ -99,7 +109,7 @@ local find_plant = function(node)
return crops.plants[i]
end
end
- minetest.log("error", "Unable to find plant \"" .. node.name .. "\" in crops table")
+ minetest.log("error", S("Unable to find plant").." \"".. node.name .. "\" "..S("in crops table"))
return nil
end