diff --git a/init.lua b/init.lua index 544d2f5..e2df5db 100644 --- a/init.lua +++ b/init.lua @@ -1,4 +1,26 @@ -local S = minetest.get_translator("calendar_node") +local S +-- Compability translator code to support MT 0.4, which doesn't support +-- translations for mods. +if not minetest.translate then + -- No translation system available, use dummy functions + local function translate(textdomain, str, ...) + local arg = {n=select('#', ...), ...} + return str:gsub("@(.)", function(matched) + local c = string.byte(matched) + if string.byte("1") <= c and c <= string.byte("9") then + return arg[c - string.byte("0")] + else + return matched + end + end) + end + + S = function(str, ...) + return translate("calendar_node", str, ...) + end +else + S = minetest.get_translator("calendar_node") +end local on_rightclick if minetest.get_modpath("calendar") then