Merge branch 'master' of https://notabug.org/TenPlus1/mobs_redo into main

This commit is contained in:
Герхард PICCORO Lenz McKAY 2022-01-21 08:47:02 -04:00
commit 71ccf3d71b
2 changed files with 9 additions and 24 deletions

30
api.lua
View File

@ -1,5 +1,5 @@
-- Load support for intllib.
local MP = minetest.get_modpath(minetest.get_current_modname())
-- Check for translation method
local S
if minetest.get_translator ~= nil then
@ -8,30 +8,18 @@ else
if minetest.get_modpath("intllib") then
dofile(minetest.get_modpath("intllib").."/init.lua")
if intllib.make_gettext_pair then
-- New method using gettext.
gettext, ngettext = intllib.make_gettext_pair()
gettext, ngettext = intllib.make_gettext_pair() -- new gettext method
else
-- Old method using text files.
gettext = intllib.Getter()
gettext = intllib.Getter() -- old text file method
end
S = gettext
else
-- mock the translator function for MT 0.4
function minetest.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
else -- boilerplate function
S = function(str, ...)
local args = {...}
return str:gsub("@%d+", function(match)
return args[tonumber(match:sub(2))]
end)
end
function minetest.get_translator(textdomain)
return function(str, ...) return minetest.translate(textdomain or "", str, ...) end
end
S = minetest.get_translator("mobs")
end
end
@ -40,7 +28,7 @@ local use_cmi = minetest.global_exists("cmi")
mobs = {
mod = "redo",
version = "20220116",
version = "20220120",
intllib = S,
invis = minetest.global_exists("invisibility") and invisibility or {}
}

View File

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