backguard compatibility for translation checks

*  this made compatible the mod with MT 0.4 and MT 5.X
main
Герхард PICCORO Lenz McKAY 2022-01-25 17:22:45 -04:00
parent 656f82f1cb
commit 999c1d0d8f
1 changed files with 22 additions and 1 deletions

View File

@ -21,7 +21,28 @@
-- Load support for MT game translation.
local S = core.get_translator(core.get_current_modname())
-- Check for translation method
local S
if minetest.get_translator ~= nil then
S = minetest.get_translator(core.get_current_modname()) -- 5.x translation function
else
if minetest.get_modpath("intllib") then
dofile(minetest.get_modpath("intllib") .. "/init.lua")
if intllib.make_gettext_pair then
gettext, ngettext = intllib.make_gettext_pair() -- new gettext method
else
gettext = intllib.Getter() -- old text file method
end
S = gettext
else -- boilerplate function
S = function(str, ...)
local args = {...}
return str:gsub("@%d+", function(match)
return args[tonumber(match:sub(2))]
end)
end
end
end
local kill_hitter = core.settings:get_bool("pvpinvul_kill_hitter")