summaryrefslogtreecommitdiff
path: root/triggers.lua
diff options
context:
space:
mode:
authorWuzzy <almikes@aol.com>2016-08-30 11:31:16 +0200
committerrubenwardy <rubenwardy@gmail.com>2016-09-01 16:21:41 +0100
commit67946bf0c4767284fa3d557d5fed6104f7bec904 (patch)
treec89ee205ad7a327459e776a715c3e9e490619cdc /triggers.lua
parent50349917e55175229abb4ae558d2b027004137c4 (diff)
Improve strings and make them translatable
Diffstat (limited to 'triggers.lua')
-rw-r--r--triggers.lua20
1 files changed, 14 insertions, 6 deletions
diff --git a/triggers.lua b/triggers.lua
index 68a1856..3bffae0 100644
--- a/triggers.lua
+++ b/triggers.lua
@@ -14,6 +14,14 @@
-- 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
--
+local S
+if (intllib) then
+ dofile(minetest.get_modpath("intllib").."/intllib.lua")
+ S = intllib.Getter(minetest.get_current_modname())
+else
+ S = function ( s ) return s end
+end
+
awards.register_trigger("dig", function(def)
local tmp = {
award = def.name,
@@ -25,7 +33,7 @@ awards.register_trigger("dig", function(def)
local itemcount = awards.get_item_count(data, "count", tmp.node) or 0
return {
perc = itemcount / tmp.target,
- label = itemcount .. " / " .. tmp.target .. " dug" -- TODO: translation
+ label = string.format(S("%d/%d dug"), itemcount, tmp.target)
}
end
end)
@@ -41,7 +49,7 @@ awards.register_trigger("place", function(def)
local itemcount = awards.get_item_count(data, "place", tmp.node) or 0
return {
perc = itemcount / tmp.target,
- label = itemcount .. " / " .. tmp.target .. " placed" -- TODO: translation
+ label = string.format(S("%d/%d placed"), itemcount, tmp.target)
}
end
end)
@@ -56,7 +64,7 @@ awards.register_trigger("death", function(def)
local itemcount = data.deaths or 0
return {
perc = itemcount / tmp.target,
- label = itemcount .. " deaths, need " .. tmp.target -- TODO: translation
+ label = string.format(S("%d/%d deaths"), itemcount, tmp.target)
}
end
end)
@@ -71,7 +79,7 @@ awards.register_trigger("chat", function(def)
local itemcount = data.chats or 0
return {
perc = itemcount / tmp.target,
- label = itemcount .. " / " .. tmp.target .. " line of chat" -- TODO: translation
+ label = string.format(S("%d/%d lines of chat"), itemcount, tmp.target)
}
end
end)
@@ -87,7 +95,7 @@ awards.register_trigger("join", function(def)
local itemcount = data.joins or 0
return {
perc = itemcount / tmp.target,
- label = itemcount .. " game joins, need " .. tmp.target -- TODO: translation
+ label = string.format(S("%d/%d game joins"), itemcount, tmp.target)
}
end
end)
@@ -103,7 +111,7 @@ awards.register_trigger("craft", function(def)
local itemcount = awards.get_item_count(data, "craft", tmp.item) or 0
return {
perc = itemcount / tmp.target,
- label = itemcount .. " / " .. tmp.target .. " crafted" -- TODO: translation
+ label = string.format(S("%d/%d crafted"), itemcount, tmp.target)
}
end
end)