5.x translator check with placeholder if not found

This commit is contained in:
tenplus1 2021-11-27 16:49:04 +00:00
parent dfcdc24dfd
commit 38f9e3e10e

View File

@ -10,7 +10,21 @@ Tweaked by TenPlus1 and Security improvements by Krock
]]-- ]]--
local S = minetest.get_translator("sfinv_bags")
-- translator check for backwards compatibility
local S
if minetest.get_translator then
S = minetest.get_translator("sfinv_bags")
else
S = function(str, ...)
local args = {...}
return str:gsub("@%d+", function(match)
return args[tonumber(match:sub(2))]
end)
end
end
local function get_player_bag_stack(player, i) local function get_player_bag_stack(player, i)