Fix broken 0.4 compat

master
Wuzzy 2020-09-08 22:44:01 +02:00
parent 58bb01a120
commit 22986ff287
1 changed files with 23 additions and 1 deletions

View File

@ -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