backuarg compat with 0.4, intllib vs get_translator
This commit is contained in:
parent
f099d7658b
commit
be5366331a
24
init.lua
24
init.lua
@ -1,6 +1,26 @@
|
|||||||
-- support for i18n
|
-- support for i18n
|
||||||
local S = minetest.get_translator(minetest.get_current_modname())
|
-- Intllib
|
||||||
|
local S
|
||||||
|
if minetest.get_translator ~= nil then
|
||||||
|
S = minetest.get_translator("ethereal") -- 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
|
||||||
|
|
||||||
if minetest.global_exists("armor") and armor.elements then
|
if minetest.global_exists("armor") and armor.elements then
|
||||||
table.insert(armor.elements, "hands")
|
table.insert(armor.elements, "hands")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user