forked from nalc/awards
Improve strings and make them translatable
This commit is contained in:
20
triggers.lua
20
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)
|
||||
|
Reference in New Issue
Block a user