From 1217d9fa884b18ea9c5f2870b4a952a5cce881c6 Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Thu, 7 Mar 2019 20:43:39 +0100 Subject: [PATCH] New translation system, part 1: entities --- mods/ENTITIES/mcl_boats/init.lua | 9 ++-- mods/ENTITIES/mcl_minecarts/init.lua | 22 ++++----- mods/ENTITIES/mcl_minecarts/rails.lua | 26 ++++++----- mods/ENTITIES/mcl_mobs/api.lua | 10 ++--- mods/ENTITIES/mobs_mc/1_items_default.lua | 6 +-- mods/ENTITIES/mobs_mc/2_throwing.lua | 4 +- mods/ENTITIES/mobs_mc/4_heads.lua | 4 +- mods/ENTITIES/mobs_mc/agent.lua | 4 +- mods/ENTITIES/mobs_mc/bat.lua | 4 +- mods/ENTITIES/mobs_mc/blaze.lua | 5 +-- mods/ENTITIES/mobs_mc/chicken.lua | 7 +-- mods/ENTITIES/mobs_mc/cow+mooshroom.lua | 4 +- mods/ENTITIES/mobs_mc/creeper.lua | 7 +-- mods/ENTITIES/mobs_mc/depends.txt | 1 - mods/ENTITIES/mobs_mc/ender_dragon.lua | 4 +- mods/ENTITIES/mobs_mc/enderman.lua | 7 +-- mods/ENTITIES/mobs_mc/endermite.lua | 4 +- mods/ENTITIES/mobs_mc/ghast.lua | 6 +-- mods/ENTITIES/mobs_mc/guardian.lua | 4 +- mods/ENTITIES/mobs_mc/guardian_elder.lua | 4 +- mods/ENTITIES/mobs_mc/horse.lua | 4 +- mods/ENTITIES/mobs_mc/intllib.lua | 45 ------------------- mods/ENTITIES/mobs_mc/iron_golem.lua | 5 +-- mods/ENTITIES/mobs_mc/llama.lua | 4 +- mods/ENTITIES/mobs_mc/ocelot.lua | 4 +- mods/ENTITIES/mobs_mc/parrot.lua | 7 +-- mods/ENTITIES/mobs_mc/pig.lua | 4 +- mods/ENTITIES/mobs_mc/polar_bear.lua | 6 +-- mods/ENTITIES/mobs_mc/rabbit.lua | 4 +- mods/ENTITIES/mobs_mc/sheep.lua | 4 +- mods/ENTITIES/mobs_mc/shulker.lua | 6 +-- mods/ENTITIES/mobs_mc/silverfish.lua | 4 +- mods/ENTITIES/mobs_mc/skeleton+stray.lua | 7 +-- mods/ENTITIES/mobs_mc/skeleton_wither.lua | 4 +- mods/ENTITIES/mobs_mc/slime+magma_cube.lua | 4 +- mods/ENTITIES/mobs_mc/snowman.lua | 5 +-- mods/ENTITIES/mobs_mc/spider.lua | 6 +-- mods/ENTITIES/mobs_mc/squid.lua | 4 +- mods/ENTITIES/mobs_mc/vex.lua | 4 +- mods/ENTITIES/mobs_mc/villager.lua | 4 +- mods/ENTITIES/mobs_mc/villager_evoker.lua | 5 +-- mods/ENTITIES/mobs_mc/villager_illusioner.lua | 4 +- mods/ENTITIES/mobs_mc/villager_vindicator.lua | 5 +-- mods/ENTITIES/mobs_mc/villager_zombie.lua | 4 +- mods/ENTITIES/mobs_mc/witch.lua | 6 +-- mods/ENTITIES/mobs_mc/wither.lua | 8 +--- mods/ENTITIES/mobs_mc/wolf.lua | 4 +- mods/ENTITIES/mobs_mc/zombie.lua | 7 +-- mods/ENTITIES/mobs_mc/zombiepig.lua | 5 +-- 49 files changed, 80 insertions(+), 245 deletions(-) delete mode 100644 mods/ENTITIES/mobs_mc/intllib.lua diff --git a/mods/ENTITIES/mcl_boats/init.lua b/mods/ENTITIES/mcl_boats/init.lua index 3ebcb6f9..32815855 100644 --- a/mods/ENTITIES/mcl_boats/init.lua +++ b/mods/ENTITIES/mcl_boats/init.lua @@ -1,3 +1,4 @@ +local S = minetest.get_translator("mcl_boats") -- -- Helper functions -- @@ -258,7 +259,7 @@ end minetest.register_entity("mcl_boats:boat", boat) local boat_ids = { "boat", "boat_spruce", "boat_birch", "boat_jungle", "boat_acacia", "boat_dark_oak" } -local names = { "Oak Boat", "Spruce Boat", "Birch Boat", "Jungle Boat", "Acacia Boat", "Dark Oak Boat" } +local names = { S("Oak Boat"), S("Spruce Boat"), S("Birch Boat"), S("Jungle Boat"), S("Acacia Boat"), S("Dark Oak Boat") } local craftstuffs = {} if minetest.get_modpath("mcl_core") then craftstuffs = { "mcl_core:wood", "mcl_core:sprucewood", "mcl_core:birchwood", "mcl_core:junglewood", "mcl_core:acaciawood", "mcl_core:darkwood" } @@ -273,9 +274,9 @@ for b=1, #boat_ids do -- Only create one help entry for all boats if b == 1 then help = true - longdesc = "Boats are used to travel on the surface of water." - usagehelp = "Rightclick on a water source to place the boat. Rightclick the boat to enter it. Use [Left] and [Right] to steer, [Forwards] to speed up and [Backwards] to slow down or move backwards. Rightclick the boat again to leave it, punch the boat to make it drop as an item." - helpname = "Boat" + longdesc = S("Boats are used to travel on the surface of water.") + usagehelp = S("Rightclick on a water source to place the boat. Rightclick the boat to enter it. Use [Left] and [Right] to steer, [Forwards] to speed up and [Backwards] to slow down or move backwards. Rightclick the boat again to leave it, punch the boat to make it drop as an item.") + helpname = S("Boat") end minetest.register_craftitem(itemstring, { diff --git a/mods/ENTITIES/mcl_minecarts/init.lua b/mods/ENTITIES/mcl_minecarts/init.lua index b053b1f6..0305dba2 100644 --- a/mods/ENTITIES/mcl_minecarts/init.lua +++ b/mods/ENTITIES/mcl_minecarts/init.lua @@ -1,3 +1,5 @@ +local S = minetest.get_translator("mcl_minecarts") + mcl_minecarts = {} mcl_minecarts.modpath = minetest.get_modpath("mcl_minecarts") mcl_minecarts.speed_max = 10 @@ -470,11 +472,11 @@ end register_minecart( "mcl_minecarts:minecart", "mcl_minecarts:minecart", - "Minecart", - "Minecarts can be used for a quick transportion on rails." .. "\n" .. - "Minecarts only ride on rails and always follow the tracks. At a T-junction with no straight way ahead, they turn left. The speed is affected by the rail type.", - "You can place the minecart on rails. Right-click it to enter it. Punch it to get it moving." .. "\n" .. - "To obtain the minecart, punch it while holding down the sneak key.", + S("Minecart"), + S("Minecarts can be used for a quick transportion on rails.") .. "\n" .. + S("Minecarts only ride on rails and always follow the tracks. At a T-junction with no straight way ahead, they turn left. The speed is affected by the rail type."), + S("You can place the minecart on rails. Right-click it to enter it. Punch it to get it moving.") .. "\n" .. + S("To obtain the minecart, punch it while holding down the sneak key."), "mcl_minecarts_minecart.b3d", {"mcl_minecarts_minecart.png"}, "mcl_minecarts_minecart_normal.png", @@ -511,7 +513,7 @@ register_minecart( register_minecart( "mcl_minecarts:chest_minecart", "mcl_minecarts:chest_minecart", - "Minecart with Chest", + S("Minecart with Chest"), nil, nil, "mcl_minecarts_minecart_chest.b3d", { "mcl_chests_normal.png", "mcl_minecarts_minecart.png" }, @@ -523,7 +525,7 @@ register_minecart( register_minecart( "mcl_minecarts:furnace_minecart", "mcl_minecarts:furnace_minecart", - "Minecart with Furnace", + S("Minecart with Furnace"), nil, nil, "mcl_minecarts_minecart_block.b3d", { @@ -566,7 +568,7 @@ register_minecart( register_minecart( "mcl_minecarts:command_block_minecart", "mcl_minecarts:command_block_minecart", - "Minecart with Command Block", + S("Minecart with Command Block"), nil, nil, "mcl_minecarts_minecart_block.b3d", { @@ -587,7 +589,7 @@ register_minecart( register_minecart( "mcl_minecarts:hopper_minecart", "mcl_minecarts:hopper_minecart", - "Minecart with Hopper", + S("Minecart with Hopper"), nil, nil, "mcl_minecarts_minecart_hopper.b3d", { @@ -605,7 +607,7 @@ register_minecart( register_minecart( "mcl_minecarts:tnt_minecart", "mcl_minecarts:tnt_minecart", - "Minecart with TNT", + S("Minecart with TNT"), nil, nil, "mcl_minecarts_minecart_block.b3d", { diff --git a/mods/ENTITIES/mcl_minecarts/rails.lua b/mods/ENTITIES/mcl_minecarts/rails.lua index 04f420f8..f288ce04 100644 --- a/mods/ENTITIES/mcl_minecarts/rails.lua +++ b/mods/ENTITIES/mcl_minecarts/rails.lua @@ -1,3 +1,5 @@ +local S = minetest.get_translator("mcl_minecarts") + -- Template rail function local register_rail = function(itemstring, tiles, def_extras, creative) local groups = {handy=1,pickaxey=1, attached_node=1,rail=1,connect_to_raillike=1,dig_by_water=1,destroy_by_lava_flow=1, transport=1} @@ -64,14 +66,14 @@ local rail_rules_long = local rail_rules_short = mesecon.rules.pplate -local railuse = "Place them on the ground to build your railway, the rails will automatically connect to each other and will turn into curves, T-junctions, crossings and slopes as needed." +local railuse = S("Place them on the ground to build your railway, the rails will automatically connect to each other and will turn into curves, T-junctions, crossings and slopes as needed.") -- Normal rail register_rail("mcl_minecarts:rail", {"default_rail.png", "default_rail_curved.png", "default_rail_t_junction.png", "default_rail_crossing.png"}, { - description = "Rail", - _doc_items_longdesc = "Rails can be used to build transport tracks for minecarts. Normal rails slightly slow down minecarts due to friction.", + description = S("Rail"), + _doc_items_longdesc = S("Rails can be used to build transport tracks for minecarts. Normal rails slightly slow down minecarts due to friction."), _doc_items_usagehelp = railuse, } ) @@ -80,9 +82,9 @@ register_rail("mcl_minecarts:rail", register_rail("mcl_minecarts:golden_rail", {"mcl_minecarts_rail_golden.png", "mcl_minecarts_rail_golden_curved.png", "mcl_minecarts_rail_golden_t_junction.png", "mcl_minecarts_rail_golden_crossing.png"}, { - description = "Powered Rail", - _doc_items_longdesc = "Rails can be used to build transport tracks for minecarts. Powered rails are able to accelerate and brake minecarts.", - _doc_items_usagehelp = railuse .. "\n" .. "Without redstone power, the rail will brake minecarts. To make this rail accelerate minecarts, power it with redstone power.", + description = S("Powered Rail"), + _doc_items_longdesc = S("Rails can be used to build transport tracks for minecarts. Powered rails are able to accelerate and brake minecarts."), + _doc_items_usagehelp = railuse .. "\n" .. S("Without redstone power, the rail will brake minecarts. To make this rail accelerate minecarts, power it with redstone power."), _rail_acceleration = -3, mesecons = { conductor = { @@ -118,9 +120,9 @@ register_rail("mcl_minecarts:golden_rail_on", register_rail("mcl_minecarts:activator_rail", {"mcl_minecarts_rail_activator.png", "mcl_minecarts_rail_activator_curved.png", "mcl_minecarts_rail_activator_t_junction.png", "mcl_minecarts_rail_activator_crossing.png"}, { - description = "Activator Rail", - _doc_items_longdesc = "Rails can be used to build transport tracks for minecarts. Activator rails are used to activate special minecarts.", - _doc_items_usagehelp = railuse .. "\n" .. "To make this rail activate minecarts, power it with redstone power and send a minecart over this piece of rail.", + description = S("Activator Rail"), + _doc_items_longdesc = S("Rails can be used to build transport tracks for minecarts. Activator rails are used to activate special minecarts."), + _doc_items_usagehelp = railuse .. "\n" .. S("To make this rail activate minecarts, power it with redstone power and send a minecart over this piece of rail."), mesecons = { conductor = { state = mesecon.state.off, @@ -157,9 +159,9 @@ register_rail("mcl_minecarts:activator_rail_on", register_rail("mcl_minecarts:detector_rail", {"mcl_minecarts_rail_detector.png", "mcl_minecarts_rail_detector_curved.png", "mcl_minecarts_rail_detector_t_junction.png", "mcl_minecarts_rail_detector_crossing.png"}, { - description = "Detector Rail", - _doc_items_longdesc = "Rails can be used to build transport tracks for minecarts. A detector rail is able to detect a minecart above it and powers redstone mechanisms.", - _doc_items_usagehelp = railuse .. "\n" .. "To detect a minecart and provide redstone power, connect it to redstone trails or redstone mechanisms and send any minecart over the rail.", + description = S("Detector Rail"), + _doc_items_longdesc = S("Rails can be used to build transport tracks for minecarts. A detector rail is able to detect a minecart above it and powers redstone mechanisms."), + _doc_items_usagehelp = railuse .. "\n" .. S("To detect a minecart and provide redstone power, connect it to redstone trails or redstone mechanisms and send any minecart over the rail."), mesecons = { receptor = { state = mesecon.state.off, diff --git a/mods/ENTITIES/mcl_mobs/api.lua b/mods/ENTITIES/mcl_mobs/api.lua index 64e3211e..3c2d61bd 100644 --- a/mods/ENTITIES/mcl_mobs/api.lua +++ b/mods/ENTITIES/mcl_mobs/api.lua @@ -9,7 +9,7 @@ local MAX_MOB_NAME_LENGTH = 30 -- Intllib local MP = minetest.get_modpath(minetest.get_current_modname()) -local S, NS = dofile(MP .. "/intllib.lua") +local S = minetest.get_translator("mcl_mobs") mobs.intllib = S @@ -71,7 +71,7 @@ local mobs_spawn_chance = tonumber(minetest.settings:get("mobs_spawn_chance") or if peaceful_only then minetest.register_on_joinplayer(function(player) minetest.chat_send_player(player:get_player_name(), - S("** Peaceful Mode Active - No Monsters Will Spawn")) + S("Peaceful mode active! No monsters will spawn.")) end) end @@ -3562,8 +3562,8 @@ function mobs:register_egg(mob, desc, background, addegg, no_creative) inventory_image = invimg, groups = grp, - _doc_items_longdesc = "This allows you to place a single mob.", - _doc_items_usagehelp = "Just place it where you want the mob to appear. Animals will spawn tamed, unless you hold down the sneak key while placing. If you place this on a mob spawner, you change the mob it spawns.", + _doc_items_longdesc = S("This allows you to place a single mob."), + _doc_items_usagehelp = S("Just place it where you want the mob to appear. Animals will spawn tamed, unless you hold down the sneak key while placing. If you place this on a mob spawner, you change the mob it spawns."), on_place = function(itemstack, placer, pointed_thing) @@ -3588,7 +3588,7 @@ function mobs:register_egg(mob, desc, background, addegg, no_creative) return itemstack end if not privs.maphack then - minetest.chat_send_player(name, "You need the “maphack” privilege to change the mob spawner.") + minetest.chat_send_player(name, S("You need the “maphack” privilege to change the mob spawner.")) return itemstack end mcl_mobspawners.setup_spawner(pointed_thing.under, itemstack:get_name()) diff --git a/mods/ENTITIES/mobs_mc/1_items_default.lua b/mods/ENTITIES/mobs_mc/1_items_default.lua index f705b782..37d54a07 100644 --- a/mods/ENTITIES/mobs_mc/1_items_default.lua +++ b/mods/ENTITIES/mobs_mc/1_items_default.lua @@ -3,13 +3,9 @@ --made for MC like Survival game --License for code WTFPL and otherwise stated in readmes - ---dofile(minetest.get_modpath("mobs").."/api.lua") --THIS IS THE MASTER ITEM LIST TO USE WITH DEFAULT --- intllib -local MP = minetest.get_modpath(minetest.get_current_modname()) -local S, NS = dofile(MP.."/intllib.lua") +local S = minetest.get_translator("mobs_mc") local c = mobs_mc.is_item_variable_overridden diff --git a/mods/ENTITIES/mobs_mc/2_throwing.lua b/mods/ENTITIES/mobs_mc/2_throwing.lua index f2f15a1a..1e4c0a55 100644 --- a/mods/ENTITIES/mobs_mc/2_throwing.lua +++ b/mods/ENTITIES/mobs_mc/2_throwing.lua @@ -3,9 +3,7 @@ --made for MC like Survival game --License for code WTFPL and otherwise stated in readmes --- intllib -local MP = minetest.get_modpath(minetest.get_current_modname()) -local S, NS = dofile(MP.."/intllib.lua") +local S = minetest.get_translator("mobs_mc") --maikerumines throwing code --arrow (weapon) diff --git a/mods/ENTITIES/mobs_mc/4_heads.lua b/mods/ENTITIES/mobs_mc/4_heads.lua index 80c97198..b60cd168 100644 --- a/mods/ENTITIES/mobs_mc/4_heads.lua +++ b/mods/ENTITIES/mobs_mc/4_heads.lua @@ -1,9 +1,7 @@ --MC Heads for minetest --maikerumine --- intllib -local MP = minetest.get_modpath(minetest.get_current_modname()) -local S, NS = dofile(MP.."/intllib.lua") +local S = minetest.get_translator("mobs_mc") -- Heads system diff --git a/mods/ENTITIES/mobs_mc/agent.lua b/mods/ENTITIES/mobs_mc/agent.lua index 9de2292e..cc4bc0da 100644 --- a/mods/ENTITIES/mobs_mc/agent.lua +++ b/mods/ENTITIES/mobs_mc/agent.lua @@ -2,9 +2,7 @@ --################### AGENT --################### --- intllib -local MP = minetest.get_modpath(minetest.get_current_modname()) -local S, NS = dofile(MP.."/intllib.lua") +local S = minetest.get_translator("mobs_mc") mobs:register_mob("mobs_mc:agent", { type = "npc", diff --git a/mods/ENTITIES/mobs_mc/bat.lua b/mods/ENTITIES/mobs_mc/bat.lua index 6021b424..10e7a3ad 100644 --- a/mods/ENTITIES/mobs_mc/bat.lua +++ b/mods/ENTITIES/mobs_mc/bat.lua @@ -1,8 +1,6 @@ --License for code WTFPL and otherwise stated in readmes --- intllib -local MP = minetest.get_modpath(minetest.get_current_modname()) -local S, NS = dofile(MP.."/intllib.lua") +local S = minetest.get_translator("mobs_mc") mobs:register_mob("mobs_mc:bat", { type = "animal", diff --git a/mods/ENTITIES/mobs_mc/blaze.lua b/mods/ENTITIES/mobs_mc/blaze.lua index 2f06c4a3..34ee630f 100644 --- a/mods/ENTITIES/mobs_mc/blaze.lua +++ b/mods/ENTITIES/mobs_mc/blaze.lua @@ -3,11 +3,8 @@ -- Model and mobs_blaze.png see https://github.com/22i/minecraft-voxel-blender-models -- blaze.lua partial copy of mobs_mc/ghast.lua --- intllib -local MP = minetest.get_modpath(minetest.get_current_modname()) -local S, NS = dofile(MP.."/intllib.lua") +local S = minetest.get_translator("mobs_mc") ---dofile(minetest.get_modpath("mobs").."/api.lua") --################### --################### BLAZE --################### diff --git a/mods/ENTITIES/mobs_mc/chicken.lua b/mods/ENTITIES/mobs_mc/chicken.lua index 0c3d0510..fec0bb53 100644 --- a/mods/ENTITIES/mobs_mc/chicken.lua +++ b/mods/ENTITIES/mobs_mc/chicken.lua @@ -1,11 +1,6 @@ --License for code WTFPL and otherwise stated in readmes --- intllib -local MP = minetest.get_modpath(minetest.get_current_modname()) -local S, NS = dofile(MP.."/intllib.lua") - - ---dofile(minetest.get_modpath("mobs").."/api.lua") +local S = minetest.get_translator("mobs_mc") --################### --################### CHICKEN diff --git a/mods/ENTITIES/mobs_mc/cow+mooshroom.lua b/mods/ENTITIES/mobs_mc/cow+mooshroom.lua index 4b08db12..83d89ff1 100644 --- a/mods/ENTITIES/mobs_mc/cow+mooshroom.lua +++ b/mods/ENTITIES/mobs_mc/cow+mooshroom.lua @@ -1,8 +1,6 @@ --License for code WTFPL and otherwise stated in readmes --- intllib -local MP = minetest.get_modpath(minetest.get_current_modname()) -local S, NS = dofile(MP.."/intllib.lua") +local S = minetest.get_translator("mobs_mc") local cow_def = { type = "animal", diff --git a/mods/ENTITIES/mobs_mc/creeper.lua b/mods/ENTITIES/mobs_mc/creeper.lua index 77fd06ac..77737997 100644 --- a/mods/ENTITIES/mobs_mc/creeper.lua +++ b/mods/ENTITIES/mobs_mc/creeper.lua @@ -1,11 +1,6 @@ --License for code WTFPL and otherwise stated in readmes --- intllib -local MP = minetest.get_modpath(minetest.get_current_modname()) -local S, NS = dofile(MP.."/intllib.lua") - ---dofile(minetest.get_modpath("mobs").."/api.lua") - +local S = minetest.get_translator("mobs_mc") --################### --################### CREEPER diff --git a/mods/ENTITIES/mobs_mc/depends.txt b/mods/ENTITIES/mobs_mc/depends.txt index 2b399cc6..b37d4adb 100644 --- a/mods/ENTITIES/mobs_mc/depends.txt +++ b/mods/ENTITIES/mobs_mc/depends.txt @@ -8,5 +8,4 @@ mcl_fishing? bones? mesecons_materials? mobs_mc_gameconfig? -intllib? doc_items? diff --git a/mods/ENTITIES/mobs_mc/ender_dragon.lua b/mods/ENTITIES/mobs_mc/ender_dragon.lua index 1492fde5..8bcd2541 100644 --- a/mods/ENTITIES/mobs_mc/ender_dragon.lua +++ b/mods/ENTITIES/mobs_mc/ender_dragon.lua @@ -2,9 +2,7 @@ --################### ENDERDRAGON --################### --- intllib -local MP = minetest.get_modpath(minetest.get_current_modname()) -local S, NS = dofile(MP.."/intllib.lua") +local S = minetest.get_translator("mobs_mc") --[[ mobs:register_mob("mobs_mc:12enderdragon", { diff --git a/mods/ENTITIES/mobs_mc/enderman.lua b/mods/ENTITIES/mobs_mc/enderman.lua index da3054a5..6af9ebe4 100644 --- a/mods/ENTITIES/mobs_mc/enderman.lua +++ b/mods/ENTITIES/mobs_mc/enderman.lua @@ -10,12 +10,7 @@ -- and they are provoked by looking directly at them. -- TODO: Implement MC behaviour. --- intllib -local MP = minetest.get_modpath(minetest.get_current_modname()) -local S, NS = dofile(MP.."/intllib.lua") - ---dofile(minetest.get_modpath("mobs").."/api.lua") - +local S = minetest.get_translator("mobs_mc") --################### --################### ENDERMAN diff --git a/mods/ENTITIES/mobs_mc/endermite.lua b/mods/ENTITIES/mobs_mc/endermite.lua index 6cdcaf76..0776ca47 100644 --- a/mods/ENTITIES/mobs_mc/endermite.lua +++ b/mods/ENTITIES/mobs_mc/endermite.lua @@ -2,9 +2,7 @@ --################### ENDERMITE --################### --- intllib -local MP = minetest.get_modpath(minetest.get_current_modname()) -local S, NS = dofile(MP.."/intllib.lua") +local S = minetest.get_translator("mobs_mc") mobs:register_mob("mobs_mc:endermite", { type = "monster", diff --git a/mods/ENTITIES/mobs_mc/ghast.lua b/mods/ENTITIES/mobs_mc/ghast.lua index 26912f43..2ed0fb95 100644 --- a/mods/ENTITIES/mobs_mc/ghast.lua +++ b/mods/ENTITIES/mobs_mc/ghast.lua @@ -3,11 +3,7 @@ --made for MC like Survival game --License for code WTFPL and otherwise stated in readmes --- intllib -local MP = minetest.get_modpath(minetest.get_current_modname()) -local S, NS = dofile(MP.."/intllib.lua") - ---dofile(minetest.get_modpath("mobs").."/api.lua") +local S = minetest.get_translator("mobs_mc") --################### --################### GHAST diff --git a/mods/ENTITIES/mobs_mc/guardian.lua b/mods/ENTITIES/mobs_mc/guardian.lua index 56bda522..89ad0964 100644 --- a/mods/ENTITIES/mobs_mc/guardian.lua +++ b/mods/ENTITIES/mobs_mc/guardian.lua @@ -4,9 +4,7 @@ --################### GUARDIAN --################### --- intllib -local MP = minetest.get_modpath(minetest.get_current_modname()) -local S, NS = dofile(MP.."/intllib.lua") +local S = minetest.get_translator("mobs_mc") mobs:register_mob("mobs_mc:guardian", { type = "monster", diff --git a/mods/ENTITIES/mobs_mc/guardian_elder.lua b/mods/ENTITIES/mobs_mc/guardian_elder.lua index 11dba11a..85ad5053 100644 --- a/mods/ENTITIES/mobs_mc/guardian_elder.lua +++ b/mods/ENTITIES/mobs_mc/guardian_elder.lua @@ -4,9 +4,7 @@ --################### GUARDIAN --################### --- intllib -local MP = minetest.get_modpath(minetest.get_current_modname()) -local S, NS = dofile(MP.."/intllib.lua") +local S = minetest.get_translator("mobs_mc") mobs:register_mob("mobs_mc:guardian_elder", { type = "monster", diff --git a/mods/ENTITIES/mobs_mc/horse.lua b/mods/ENTITIES/mobs_mc/horse.lua index 533948a0..c2054300 100644 --- a/mods/ENTITIES/mobs_mc/horse.lua +++ b/mods/ENTITIES/mobs_mc/horse.lua @@ -3,9 +3,7 @@ --made for MC like Survival game --License for code WTFPL and otherwise stated in readmes --- intllib -local MP = minetest.get_modpath(minetest.get_current_modname()) -local S, NS = dofile(MP.."/intllib.lua") +local S = minetest.get_translator("mobs_mc") --################### --################### HORSE diff --git a/mods/ENTITIES/mobs_mc/intllib.lua b/mods/ENTITIES/mobs_mc/intllib.lua deleted file mode 100644 index 6669d720..00000000 --- a/mods/ENTITIES/mobs_mc/intllib.lua +++ /dev/null @@ -1,45 +0,0 @@ - --- Fallback functions for when `intllib` is not installed. --- Code released under Unlicense . - --- Get the latest version of this file at: --- https://raw.githubusercontent.com/minetest-mods/intllib/master/lib/intllib.lua - -local function format(str, ...) - local args = { ... } - local function repl(escape, open, num, close) - if escape == "" then - local replacement = tostring(args[tonumber(num)]) - if open == "" then - replacement = replacement..close - end - return replacement - else - return "@"..open..num..close - end - end - return (str:gsub("(@?)@(%(?)(%d+)(%)?)", repl)) -end - -local gettext, ngettext -if minetest.get_modpath("intllib") then - if intllib.make_gettext_pair then - -- New method using gettext. - gettext, ngettext = intllib.make_gettext_pair() - else - -- Old method using text files. - gettext = intllib.Getter() - end -end - --- Fill in missing functions. - -gettext = gettext or function(msgid, ...) - return format(msgid, ...) -end - -ngettext = ngettext or function(msgid, msgid_plural, n, ...) - return format(n==1 and msgid or msgid_plural, ...) -end - -return gettext, ngettext diff --git a/mods/ENTITIES/mobs_mc/iron_golem.lua b/mods/ENTITIES/mobs_mc/iron_golem.lua index ebd93dc6..9ca88ba5 100644 --- a/mods/ENTITIES/mobs_mc/iron_golem.lua +++ b/mods/ENTITIES/mobs_mc/iron_golem.lua @@ -3,11 +3,8 @@ --made for MC like Survival game --License for code WTFPL and otherwise stated in readmes --- intllib -local MP = minetest.get_modpath(minetest.get_current_modname()) -local S, NS = dofile(MP.."/intllib.lua") +local S = minetest.get_translator("mobs_mc") ---dofile(minetest.get_modpath("mobs").."/api.lua") --################### --################### IRON GOLEM --################### diff --git a/mods/ENTITIES/mobs_mc/llama.lua b/mods/ENTITIES/mobs_mc/llama.lua index e70b9a18..a69db0ba 100644 --- a/mods/ENTITIES/mobs_mc/llama.lua +++ b/mods/ENTITIES/mobs_mc/llama.lua @@ -1,6 +1,4 @@ --- intllib -local MP = minetest.get_modpath(minetest.get_current_modname()) -local S, NS = dofile(MP.."/intllib.lua") +local S = minetest.get_translator("mobs_mc") --################### --################### LLAMA diff --git a/mods/ENTITIES/mobs_mc/ocelot.lua b/mods/ENTITIES/mobs_mc/ocelot.lua index 58a7d94f..634d77a3 100644 --- a/mods/ENTITIES/mobs_mc/ocelot.lua +++ b/mods/ENTITIES/mobs_mc/ocelot.lua @@ -3,9 +3,7 @@ --made for MC like Survival game --License for code WTFPL and otherwise stated in readmes --- intllib -local MP = minetest.get_modpath(minetest.get_current_modname()) -local S, NS = dofile(MP.."/intllib.lua") +local S = minetest.get_translator("mobs_mc") --################### --################### OCELOT AND CAT diff --git a/mods/ENTITIES/mobs_mc/parrot.lua b/mods/ENTITIES/mobs_mc/parrot.lua index 89e4c77f..7e465e8f 100644 --- a/mods/ENTITIES/mobs_mc/parrot.lua +++ b/mods/ENTITIES/mobs_mc/parrot.lua @@ -3,12 +3,7 @@ --made for MC like Survival game --License for code WTFPL and otherwise stated in readmes --- intllib -local MP = minetest.get_modpath(minetest.get_current_modname()) -local S, NS = dofile(MP.."/intllib.lua") - ---dofile(minetest.get_modpath("mobs").."/api.lua") - +local S = minetest.get_translator("mobs_mc") --################### --################### PARROT diff --git a/mods/ENTITIES/mobs_mc/pig.lua b/mods/ENTITIES/mobs_mc/pig.lua index 1f685c2f..2b10c99b 100644 --- a/mods/ENTITIES/mobs_mc/pig.lua +++ b/mods/ENTITIES/mobs_mc/pig.lua @@ -1,8 +1,6 @@ --License for code WTFPL and otherwise stated in readmes --- intllib -local MP = minetest.get_modpath(minetest.get_current_modname()) -local S, NS = dofile(MP.."/intllib.lua") +local S = minetest.get_translator("mobs_mc") mobs:register_mob("mobs_mc:pig", { type = "animal", diff --git a/mods/ENTITIES/mobs_mc/polar_bear.lua b/mods/ENTITIES/mobs_mc/polar_bear.lua index 84da77e7..1db07e0f 100644 --- a/mods/ENTITIES/mobs_mc/polar_bear.lua +++ b/mods/ENTITIES/mobs_mc/polar_bear.lua @@ -1,10 +1,6 @@ --License for code WTFPL and otherwise stated in readmes --- intllib -local MP = minetest.get_modpath(minetest.get_current_modname()) -local S, NS = dofile(MP.."/intllib.lua") - ---dofile(minetest.get_modpath("mobs").."/api.lua") +local S = minetest.get_translator("mobs_mc") --################### --################### POLARBEAR diff --git a/mods/ENTITIES/mobs_mc/rabbit.lua b/mods/ENTITIES/mobs_mc/rabbit.lua index a92c93f9..ea71d788 100644 --- a/mods/ENTITIES/mobs_mc/rabbit.lua +++ b/mods/ENTITIES/mobs_mc/rabbit.lua @@ -1,8 +1,6 @@ --License for code WTFPL and otherwise stated in readmes --- intllib -local MP = minetest.get_modpath(minetest.get_current_modname()) -local S, NS = dofile(MP.."/intllib.lua") +local S = minetest.get_translator("mobs_mc") local rabbit = { type = "animal", diff --git a/mods/ENTITIES/mobs_mc/sheep.lua b/mods/ENTITIES/mobs_mc/sheep.lua index 9ddf9e03..c734cfe2 100644 --- a/mods/ENTITIES/mobs_mc/sheep.lua +++ b/mods/ENTITIES/mobs_mc/sheep.lua @@ -1,8 +1,6 @@ --License for code WTFPL and otherwise stated in readmes --- intllib -local MP = minetest.get_modpath(minetest.get_current_modname()) -local S, NS = dofile(MP.."/intllib.lua") +local S = minetest.get_translator("mobs_mc") --################### --################### SHEEP diff --git a/mods/ENTITIES/mobs_mc/shulker.lua b/mods/ENTITIES/mobs_mc/shulker.lua index ddb17e7c..0d23a14f 100644 --- a/mods/ENTITIES/mobs_mc/shulker.lua +++ b/mods/ENTITIES/mobs_mc/shulker.lua @@ -3,11 +3,7 @@ --made for MC like Survival game --License for code WTFPL and otherwise stated in readmes --- intllib -local MP = minetest.get_modpath(minetest.get_current_modname()) -local S, NS = dofile(MP.."/intllib.lua") - ---dofile(minetest.get_modpath("mobs").."/api.lua") +local S = minetest.get_translator("mobs_mc") --################### --################### SHULKER diff --git a/mods/ENTITIES/mobs_mc/silverfish.lua b/mods/ENTITIES/mobs_mc/silverfish.lua index dc2a9c92..77415b40 100644 --- a/mods/ENTITIES/mobs_mc/silverfish.lua +++ b/mods/ENTITIES/mobs_mc/silverfish.lua @@ -2,9 +2,7 @@ --################### SILVERFISH --################### --- intllib -local MP = minetest.get_modpath(minetest.get_current_modname()) -local S, NS = dofile(MP.."/intllib.lua") +local S = minetest.get_translator("mobs_mc") mobs:register_mob("mobs_mc:silverfish", { type = "monster", diff --git a/mods/ENTITIES/mobs_mc/skeleton+stray.lua b/mods/ENTITIES/mobs_mc/skeleton+stray.lua index a10fef5e..35cc9ed8 100644 --- a/mods/ENTITIES/mobs_mc/skeleton+stray.lua +++ b/mods/ENTITIES/mobs_mc/skeleton+stray.lua @@ -3,12 +3,7 @@ --made for MC like Survival game --License for code WTFPL and otherwise stated in readmes --- intllib -local MP = minetest.get_modpath(minetest.get_current_modname()) -local S, NS = dofile(MP.."/intllib.lua") - ---dofile(minetest.get_modpath("mobs").."/api.lua") - +local S = minetest.get_translator("mobs_mc") --################### --################### SKELETON diff --git a/mods/ENTITIES/mobs_mc/skeleton_wither.lua b/mods/ENTITIES/mobs_mc/skeleton_wither.lua index cd932129..16f353ce 100644 --- a/mods/ENTITIES/mobs_mc/skeleton_wither.lua +++ b/mods/ENTITIES/mobs_mc/skeleton_wither.lua @@ -3,9 +3,7 @@ --made for MC like Survival game --License for code WTFPL and otherwise stated in readmes --- intllib -local MP = minetest.get_modpath(minetest.get_current_modname()) -local S, NS = dofile(MP.."/intllib.lua") +local S = minetest.get_translator("mobs_mc") --################### --################### WITHER SKELETON diff --git a/mods/ENTITIES/mobs_mc/slime+magma_cube.lua b/mods/ENTITIES/mobs_mc/slime+magma_cube.lua index 2c21dcfa..da52d3bc 100644 --- a/mods/ENTITIES/mobs_mc/slime+magma_cube.lua +++ b/mods/ENTITIES/mobs_mc/slime+magma_cube.lua @@ -1,8 +1,6 @@ --License for code WTFPL and otherwise stated in readmes --- intllib -local MP = minetest.get_modpath(minetest.get_current_modname()) -local S, NS = dofile(MP.."/intllib.lua") +local S = minetest.get_translator("mobs_mc") -- Returns a function that spawns children in a circle around pos. -- To be used as on_die callback. diff --git a/mods/ENTITIES/mobs_mc/snowman.lua b/mods/ENTITIES/mobs_mc/snowman.lua index 1c1ad686..f0f8fc4f 100644 --- a/mods/ENTITIES/mobs_mc/snowman.lua +++ b/mods/ENTITIES/mobs_mc/snowman.lua @@ -3,9 +3,8 @@ --made for MC like Survival game --License for code WTFPL and otherwise stated in readmes --- intllib -local MP = minetest.get_modpath(minetest.get_current_modname()) -local S, NS = dofile(MP.."/intllib.lua") +local S = minetest.get_translator("mobs_mc") + local snow_trail_frequency = 0.5 -- Time in seconds for checking to add a new snow trail local mobs_griefing = minetest.settings:get_bool("mobs_griefing") ~= false diff --git a/mods/ENTITIES/mobs_mc/spider.lua b/mods/ENTITIES/mobs_mc/spider.lua index 2fe6ae53..9ec7f44b 100644 --- a/mods/ENTITIES/mobs_mc/spider.lua +++ b/mods/ENTITIES/mobs_mc/spider.lua @@ -3,11 +3,7 @@ --made for MC like Survival game --License for code WTFPL and otherwise stated in readmes --- intllib -local MP = minetest.get_modpath(minetest.get_current_modname()) -local S, NS = dofile(MP.."/intllib.lua") - ---dofile(minetest.get_modpath("mobs").."/api.lua") +local S = minetest.get_translator("mobs_mc") --################### --################### SPIDER diff --git a/mods/ENTITIES/mobs_mc/squid.lua b/mods/ENTITIES/mobs_mc/squid.lua index 721f861b..b22ca08f 100644 --- a/mods/ENTITIES/mobs_mc/squid.lua +++ b/mods/ENTITIES/mobs_mc/squid.lua @@ -4,9 +4,7 @@ --################### SQUID --################### --- intllib -local MP = minetest.get_modpath(minetest.get_current_modname()) -local S, NS = dofile(MP.."/intllib.lua") +local S = minetest.get_translator("mobs_mc") mobs:register_mob("mobs_mc:squid", { type = "animal", diff --git a/mods/ENTITIES/mobs_mc/vex.lua b/mods/ENTITIES/mobs_mc/vex.lua index 01f7af70..692783e0 100644 --- a/mods/ENTITIES/mobs_mc/vex.lua +++ b/mods/ENTITIES/mobs_mc/vex.lua @@ -3,9 +3,7 @@ --made for MC like Survival game --License for code WTFPL and otherwise stated in readmes --- intllib -local MP = minetest.get_modpath(minetest.get_current_modname()) -local S, NS = dofile(MP.."/intllib.lua") +local S = minetest.get_translator("mobs_mc") --################### --################### VEX diff --git a/mods/ENTITIES/mobs_mc/villager.lua b/mods/ENTITIES/mobs_mc/villager.lua index e2d91310..4357cebc 100644 --- a/mods/ENTITIES/mobs_mc/villager.lua +++ b/mods/ENTITIES/mobs_mc/villager.lua @@ -19,9 +19,7 @@ -- TODO: Internal inventory, pick up items, trade with other villagers -- TODO: Farm stuff --- intllib -local MP = minetest.get_modpath(minetest.get_current_modname()) -local S, NS = dofile(MP.."/intllib.lua") +local S = minetest.get_translator("mobs_mc") -- playername-indexed table containing the previously used tradenum local player_tradenum = {} diff --git a/mods/ENTITIES/mobs_mc/villager_evoker.lua b/mods/ENTITIES/mobs_mc/villager_evoker.lua index 6d9fc87a..22af9d4b 100644 --- a/mods/ENTITIES/mobs_mc/villager_evoker.lua +++ b/mods/ENTITIES/mobs_mc/villager_evoker.lua @@ -3,11 +3,8 @@ --made for MC like Survival game --License for code WTFPL and otherwise stated in readmes --- intllib -local MP = minetest.get_modpath(minetest.get_current_modname()) -local S, NS = dofile(MP.."/intllib.lua") +local S = minetest.get_translator("mobs_mc") ---dofile(minetest.get_modpath("mobs").."/api.lua") --################### --################### EVOKER --################### diff --git a/mods/ENTITIES/mobs_mc/villager_illusioner.lua b/mods/ENTITIES/mobs_mc/villager_illusioner.lua index e6d1b2c9..de4ee89d 100644 --- a/mods/ENTITIES/mobs_mc/villager_illusioner.lua +++ b/mods/ENTITIES/mobs_mc/villager_illusioner.lua @@ -3,9 +3,7 @@ --made for MC like Survival game --License for code WTFPL and otherwise stated in readmes --- intllib -local MP = minetest.get_modpath(minetest.get_current_modname()) -local S, NS = dofile(MP.."/intllib.lua") +local S = minetest.get_translator("mobs_mc") mobs:register_mob("mobs_mc:illusioner", { type = "monster", diff --git a/mods/ENTITIES/mobs_mc/villager_vindicator.lua b/mods/ENTITIES/mobs_mc/villager_vindicator.lua index 82eff89b..9558074a 100644 --- a/mods/ENTITIES/mobs_mc/villager_vindicator.lua +++ b/mods/ENTITIES/mobs_mc/villager_vindicator.lua @@ -3,11 +3,8 @@ --made for MC like Survival game --License for code WTFPL and otherwise stated in readmes --- intllib -local MP = minetest.get_modpath(minetest.get_current_modname()) -local S, NS = dofile(MP.."/intllib.lua") +local S = minetest.get_translator("mobs_mc") ---dofile(minetest.get_modpath("mobs").."/api.lua") --################### --################### VINDICATOR --################### diff --git a/mods/ENTITIES/mobs_mc/villager_zombie.lua b/mods/ENTITIES/mobs_mc/villager_zombie.lua index f340c043..7e8037df 100644 --- a/mods/ENTITIES/mobs_mc/villager_zombie.lua +++ b/mods/ENTITIES/mobs_mc/villager_zombie.lua @@ -3,9 +3,7 @@ --made for MC like Survival game --License for code WTFPL and otherwise stated in readmes --- intllib -local MP = minetest.get_modpath(minetest.get_current_modname()) -local S, NS = dofile(MP.."/intllib.lua") +local S = minetest.get_translator("mobs_mc") -- TODO: Turn villagers to zombie villager diff --git a/mods/ENTITIES/mobs_mc/witch.lua b/mods/ENTITIES/mobs_mc/witch.lua index 7edce46e..83e7b7b3 100644 --- a/mods/ENTITIES/mobs_mc/witch.lua +++ b/mods/ENTITIES/mobs_mc/witch.lua @@ -3,11 +3,7 @@ --made for MC like Survival game --License for code WTFPL and otherwise stated in readmes --- intllib -local MP = minetest.get_modpath(minetest.get_current_modname()) -local S, NS = dofile(MP.."/intllib.lua") - ---dofile(minetest.get_modpath("mobs").."/api.lua") +local S = minetest.get_translator("mobs_mc") --################### --################### WITCH diff --git a/mods/ENTITIES/mobs_mc/wither.lua b/mods/ENTITIES/mobs_mc/wither.lua index 9602d5a5..d61237a9 100644 --- a/mods/ENTITIES/mobs_mc/wither.lua +++ b/mods/ENTITIES/mobs_mc/wither.lua @@ -3,18 +3,12 @@ --made for MC like Survival game --License for code WTFPL and otherwise stated in readmes --- intllib -local MP = minetest.get_modpath(minetest.get_current_modname()) -local S, NS = dofile(MP.."/intllib.lua") +local S = minetest.get_translator("mobs_mc") ---dofile(minetest.get_modpath("mobs").."/api.lua") - - --################### --################### WITHER --################### - mobs:register_mob("mobs_mc:wither", { type = "monster", hp_max = 300, diff --git a/mods/ENTITIES/mobs_mc/wolf.lua b/mods/ENTITIES/mobs_mc/wolf.lua index fc73e834..b7e69864 100644 --- a/mods/ENTITIES/mobs_mc/wolf.lua +++ b/mods/ENTITIES/mobs_mc/wolf.lua @@ -1,8 +1,6 @@ --License for code WTFPL and otherwise stated in readmes --- intllib -local MP = minetest.get_modpath(minetest.get_current_modname()) -local S, NS = dofile(MP.."/intllib.lua") +local S = minetest.get_translator("mobs_mc") local default_walk_chance = 50 diff --git a/mods/ENTITIES/mobs_mc/zombie.lua b/mods/ENTITIES/mobs_mc/zombie.lua index 72c76b32..0b329c55 100644 --- a/mods/ENTITIES/mobs_mc/zombie.lua +++ b/mods/ENTITIES/mobs_mc/zombie.lua @@ -3,12 +3,7 @@ --made for MC like Survival game --License for code WTFPL and otherwise stated in readmes --- intllib -local MP = minetest.get_modpath(minetest.get_current_modname()) -local S, NS = dofile(MP.."/intllib.lua") - ---dofile(minetest.get_modpath("mobs").."/api.lua") - +local S = minetest.get_translator("mobs_mc") --################### --################### ZOMBIE diff --git a/mods/ENTITIES/mobs_mc/zombiepig.lua b/mods/ENTITIES/mobs_mc/zombiepig.lua index d85c2ceb..a4b1db60 100644 --- a/mods/ENTITIES/mobs_mc/zombiepig.lua +++ b/mods/ENTITIES/mobs_mc/zombiepig.lua @@ -3,11 +3,8 @@ --made for MC like Survival game --License for code WTFPL and otherwise stated in readmes --- intllib -local MP = minetest.get_modpath(minetest.get_current_modname()) -local S, NS = dofile(MP.."/intllib.lua") +local S = minetest.get_translator("mobs_mc") ---dofile(minetest.get_modpath("mobs").."/api.lua") --################### --################### ZOMBIE PIGMAN --###################