Add intllib support

This commit is contained in:
Wuzzy 2016-08-05 17:43:55 +02:00
parent f2e6e6e8ad
commit 7b0ef7204b
4 changed files with 15 additions and 2 deletions

View File

@ -1 +1,2 @@
hudbars?
intllib?

View File

@ -9,6 +9,14 @@ License: WTFPL
Initialization
]===]
local S
if (minetest.get_modpath("intllib")) then
dofile(minetest.get_modpath("intllib").."/intllib.lua")
S = intllib.Getter(minetest.get_current_modname())
else
S = function ( s ) return s end
end
mana = {}
mana.playerlist = {}
@ -269,7 +277,7 @@ end)
]===]
if minetest.get_modpath("hudbars") ~= nil then
hb.register_hudbar("mana", 0xFFFFFF, "Mana", { bar = "mana_bar.png", icon = "mana_icon.png", bgicon = "mana_bgicon.png" }, 0, mana.settings.default_max, false)
hb.register_hudbar("mana", 0xFFFFFF, S("Mana"), { bar = "mana_bar.png", icon = "mana_icon.png", bgicon = "mana_bgicon.png" }, 0, mana.settings.default_max, false)
function mana.hud_update(playername)
local player = minetest.get_player_by_name(playername)
@ -283,7 +291,7 @@ if minetest.get_modpath("hudbars") ~= nil then
else
function mana.manastring(playername)
return string.format("Mana: %d/%d", mana.get(playername), mana.getmax(playername))
return string.format(S("Mana: %d/%d"), mana.get(playername), mana.getmax(playername))
end
function mana.hud_add(playername)

2
locale/de.txt Normal file
View File

@ -0,0 +1,2 @@
Mana = Mana
Mana: %d/%d = Mana: %d/%d

2
locale/template.txt Normal file
View File

@ -0,0 +1,2 @@
Mana
Mana: %d/%d