summaryrefslogtreecommitdiff
path: root/lua/api.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/api.lua
parentcb616b0df9e0a07b9e569898c1d3cc265e6c13bf (diff)
Add i18n support using intllib
Diffstat (limited to 'lua/api.lua')
-rwxr-xr-xlua/api.lua12
1 files changed, 8 insertions, 4 deletions
diff --git a/lua/api.lua b/lua/api.lua
index f49035b..9d54f53 100755
--- a/lua/api.lua
+++ b/lua/api.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")
+
drawers.node_box_simple = {
{-0.5, -0.5, -0.4375, 0.5, 0.5, 0.5},
{-0.5, -0.5, -0.5, -0.4375, 0.5, -0.4375},
@@ -125,7 +129,7 @@ function drawers.drawer_insert_object(pos, node, stack, direction)
end
function drawers.register_drawer(name, def)
- def.description = def.description or "Wooden"
+ def.description = def.description or S("Wooden")
def.drawtype = "nodebox"
def.node_box = {type = "fixed", fixed = drawers.node_box_simple}
def.collision_box = {type = "regular"}
@@ -160,7 +164,7 @@ function drawers.register_drawer(name, def)
if drawers.enable_1x1 then
-- normal drawer 1x1 = 1
local def1 = table.copy(def)
- def1.description = def.description .. " Drawer"
+ def1.description = S("@1 Drawer", def.description)
def1.tiles = def.tiles or def.tiles1
def1.tiles1 = nil
def1.tiles2 = nil
@@ -173,7 +177,7 @@ function drawers.register_drawer(name, def)
if drawers.enable_1x2 then
-- 1x2 = 2
local def2 = table.copy(def)
- def2.description = def.description .. " Drawers (1x2)"
+ def2.description = S("@1 Drawers (1x2)", def.description)
def2.tiles = def.tiles2
def2.tiles1 = nil
def2.tiles2 = nil
@@ -185,7 +189,7 @@ function drawers.register_drawer(name, def)
if drawers.enable_2x2 then
-- 2x2 = 4
local def4 = table.copy(def)
- def4.description = def.description .. " Drawers (2x2)"
+ def4.description = S("@1 Drawers (2x2)", def.description)
def4.tiles = def.tiles4
def4.tiles1 = nil
def4.tiles2 = nil