summaryrefslogtreecommitdiff
path: root/lua/helpers.lua
diff options
context:
space:
mode:
authorLNJ <git@lnj.li>2017-04-11 13:02:31 +0200
committerLNJ <git@lnj.li>2017-04-11 13:02:31 +0200
commitcde5c46e449e49e1435ac649bf344234ccd61f80 (patch)
tree57e4d51c44d4c4a052d948f0fb73217050a58285 /lua/helpers.lua
parentcb616b0df9e0a07b9e569898c1d3cc265e6c13bf (diff)
Add i18n support using intllib
Diffstat (limited to 'lua/helpers.lua')
-rwxr-xr-xlua/helpers.lua9
1 files changed, 6 insertions, 3 deletions
diff --git a/lua/helpers.lua b/lua/helpers.lua
index 12997d1..fa1087a 100755
--- a/lua/helpers.lua
+++ b/lua/helpers.lua
@@ -25,6 +25,10 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
]]
+-- Load support for intllib.
+local MP = core.get_modpath(core.get_current_modname())
+local S, NS = dofile(MP.."/intllib.lua")
+
function drawers.gen_info_text(basename, count, factor, stack_max)
local maxCount = stack_max * factor
local percent = count / maxCount * 100
@@ -32,10 +36,9 @@ function drawers.gen_info_text(basename, count, factor, stack_max)
percent = math.floor(percent + 0.5)
if count == 0 then
- return basename .. " (" .. tostring(percent) .. "% full)"
+ return S("@1 (@2% full)", basename, tostring(percent))
else
- return tostring(count) .. " " .. basename .. " (" ..
- tostring(percent) .. "% full)"
+ return S("@1 @2 (@3% full)", tostring(count), basename, tostring(percent))
end
end