summaryrefslogtreecommitdiff
path: root/internal.lua
diff options
context:
space:
mode:
authorRealBadAngel <maciej.kasatkin@o2.pl>2014-06-21 12:44:31 +0200
committerRealBadAngel <maciej.kasatkin@o2.pl>2014-06-21 12:44:31 +0200
commit002bcbb6d82efe299ba781726ddc44ce890dfc61 (patch)
tree77e23f451a8dac9dfb060f7982c1897277a4d89c /internal.lua
parent87f502a2592bbd41e99df9009a966111156f0181 (diff)
Add intllib support.
Some polish and german translations. Start adding tooltips.
Diffstat (limited to 'internal.lua')
-rw-r--r--internal.lua11
1 files changed, 10 insertions, 1 deletions
diff --git a/internal.lua b/internal.lua
index 4d9c10b..c35bd4c 100644
--- a/internal.lua
+++ b/internal.lua
@@ -1,3 +1,10 @@
+local S
+if intllib then
+ S = intllib.Getter()
+else
+ S = function(s) return s end
+end
+
-- This pair of encoding functions is used where variable text must go in
-- button names, where the text might contain formspec metacharacters.
-- We can escape button names for the formspec, to avoid screwing up
@@ -36,11 +43,13 @@ function unified_inventory.get_formspec(player, page)
-- Main buttons
for i, def in pairs(unified_inventory.buttons) do
+ local tooltip = def.tooltip or ""
if def.type == "image" then
formspec = formspec.."image_button["
..(0.65 * (i - 1))..",9;0.8,0.8;"
..minetest.formspec_escape(def.image)..";"
- ..minetest.formspec_escape(def.name)..";]"
+ ..minetest.formspec_escape(def.name)..";;;;;"
+ ..tooltip.."]"
end
end