fix translation support

This commit is contained in:
tenplus1 2022-02-10 14:57:25 +00:00
parent cdfa83c6dc
commit 35fcd870cf
2 changed files with 24 additions and 6 deletions

View File

@ -4,9 +4,30 @@
-- the default sfinv or inventory_plus when running.
-- Released by TenPlus1 and based on Zeg9's code under MIT license
-- Load support for intllib.
local S = minetest.get_translator and minetest.get_translator("simple_skins") or
dofile(skins.modpath .. "/intllib.lua")
-- Load support for translation.
local S
if minetest.get_translator ~= nil then
S = minetest.get_translator("simple_skins")
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
skins = {
skins = {}, list = {}, meta = {}, formspec = {},

View File

@ -1,3 +0,0 @@
-- Support for the old multi-load method
dofile(minetest.get_modpath("intllib").."/init.lua")