diff --git a/dirt_monster.lua b/dirt_monster.lua index 3631fb2..ab2b6d9 100644 --- a/dirt_monster.lua +++ b/dirt_monster.lua @@ -1,5 +1,5 @@ -local S = mobs.intllib +local S = mobs.intllib_monster local dirt_types = { diff --git a/dungeon_master.lua b/dungeon_master.lua index b2f9a45..3903dd3 100644 --- a/dungeon_master.lua +++ b/dungeon_master.lua @@ -1,5 +1,5 @@ -local S = mobs.intllib +local S = mobs.intllib_monster local master_types = { diff --git a/fire_spirit.lua b/fire_spirit.lua index 6e9bea9..33dd049 100644 --- a/fire_spirit.lua +++ b/fire_spirit.lua @@ -1,5 +1,5 @@ -local S = mobs.intllib +local S = mobs.intllib_monster local mob_drops = { {name = "fireflies:firefly", chance = 1, min = 1, max = 1} diff --git a/init.lua b/init.lua index e00db93..5c81838 100644 --- a/init.lua +++ b/init.lua @@ -2,10 +2,32 @@ -- Load support for intllib. local path = minetest.get_modpath(minetest.get_current_modname()) .. "/" -local S = minetest.get_translator and minetest.get_translator("mobs_monster") or - dofile(path .. "intllib.lua") +local S -mobs.intllib = S +-- Check for translation method +local S +if minetest.get_translator ~= nil then + S = minetest.get_translator("mobs_monster") -- 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 + +mobs.intllib_monster = S -- Check for custom mob spawn file diff --git a/intllib.lua b/intllib.lua deleted file mode 100644 index 7decdf7..0000000 --- a/intllib.lua +++ /dev/null @@ -1,3 +0,0 @@ --- Support for the old multi-load method -return dofile(minetest.get_modpath("intllib").."/init.lua") - diff --git a/land_guard.lua b/land_guard.lua index 6545b33..5199463 100644 --- a/land_guard.lua +++ b/land_guard.lua @@ -1,5 +1,5 @@ -local S = mobs.intllib +local S = mobs.intllib_monster local guard_types = { diff --git a/lava_flan.lua b/lava_flan.lua index 1e957e3..069a5df 100644 --- a/lava_flan.lua +++ b/lava_flan.lua @@ -1,6 +1,5 @@ -local S = mobs.intllib - +local S = mobs.intllib_monster -- Lava Flan by Zeg9 (additional textures by JurajVajda) diff --git a/mese_monster.lua b/mese_monster.lua index 949a087..772d4e1 100644 --- a/mese_monster.lua +++ b/mese_monster.lua @@ -1,6 +1,5 @@ -local S = mobs.intllib - +local S = mobs.intllib_monster -- Mese Monster by Zeg9 diff --git a/oerkki.lua b/oerkki.lua index f706b43..c8656fe 100644 --- a/oerkki.lua +++ b/oerkki.lua @@ -1,6 +1,5 @@ -local S = mobs.intllib - +local S = mobs.intllib_monster -- Oerkki by PilzAdam diff --git a/sand_monster.lua b/sand_monster.lua index 67595be..4740e00 100644 --- a/sand_monster.lua +++ b/sand_monster.lua @@ -1,6 +1,5 @@ -local S = mobs.intllib - +local S = mobs.intllib_monster -- custom particle effects local effect = function( diff --git a/spider.lua b/spider.lua index 4a74b3b..9f833f2 100644 --- a/spider.lua +++ b/spider.lua @@ -1,5 +1,5 @@ -local S = mobs.intllib +local S = mobs.intllib_monster local get_velocity = function(self) diff --git a/stone_monster.lua b/stone_monster.lua index eb8d650..aad9ef8 100644 --- a/stone_monster.lua +++ b/stone_monster.lua @@ -1,5 +1,5 @@ -local S = mobs.intllib +local S = mobs.intllib_monster local stone_types = { diff --git a/tree_monster.lua b/tree_monster.lua index 4276f02..2d23491 100644 --- a/tree_monster.lua +++ b/tree_monster.lua @@ -1,5 +1,5 @@ -local S = mobs.intllib +local S = mobs.intllib_monster local tree_types = {