Manual update due to conflict (part 2)

This adds part of PR #4 and they came from inpos/areas repo, this adds i18n : intllib po/pot method and french translation. Author is fat115
This commit is contained in:
Muhammad Nur Hidayat Yasuyoshi (MNH48.com) 2018-02-17 02:18:30 +08:00
parent a23d2bad3a
commit 132b5289db
11 changed files with 1172 additions and 168 deletions

View File

@ -1,59 +1,59 @@
local S = areas.intllib
minetest.register_chatcommand("protect", { minetest.register_chatcommand("protect", {
params = "<AreaName>", params = "<AreaName>",
description = "Protect your own area", description = S("Protect your own area"),
privs = {[areas.config.self_protection_privilege]=true}, privs = {[areas.config.self_protection_privilege]=true},
func = function(name, param) func = function(name, param)
if param == "" then if param == "" then
return false, "Invalid usage, see /help protect." return false, S("Invalid usage, see /help protect.")
end end
local pos1, pos2 = areas:getPos(name) local pos1, pos2 = areas:getPos(name)
if not (pos1 and pos2) then if not (pos1 and pos2) then
return false, "You need to select an area first." return false, S("You need to select an area first.")
end end
minetest.log("action", "/protect invoked, owner="..name.. minetest.log("action", S("/protect invoked, Owner =")..name..
" AreaName="..param.. " AreaName="..param..
" StartPos="..minetest.pos_to_string(pos1).. " StartPos="..minetest.pos_to_string(pos1)..
" EndPos=" ..minetest.pos_to_string(pos2)) " EndPos=" ..minetest.pos_to_string(pos2))
local canAdd, errMsg = areas:canPlayerAddArea(pos1, pos2, name) local canAdd, errMsg = areas:canPlayerAddArea(pos1, pos2, name)
if not canAdd then if not canAdd then
return false, "You can't protect that area: "..errMsg return false, S("You can't protect that area: ")..errMsg
end end
local id = areas:add(name, param, pos1, pos2, nil) local id = areas:add(name, param, pos1, pos2, nil)
areas:save() areas:save()
return true, "Area protected. ID: "..id return true, S("Area protected. ID: ")..id
end end
}) })
minetest.register_chatcommand("set_owner", { minetest.register_chatcommand("set_owner", {
params = "<PlayerName> <AreaName>", params = "<PlayerName> <AreaName>",
description = "Protect an area beetween two positions and give" description = S("Protect an area beetween two positions and give"
.." a player access to it without setting the parent of the" .." a player access to it without setting the parent of the"
.." area to any existing area", .." area to any existing area"),
privs = areas.adminPrivs, privs = areas.adminPrivs,
func = function(name, param) func = function(name, param)
local ownerName, areaName = param:match('^(%S+)%s(.+)$') local ownerName, areaName = param:match('^(%S+)%s(.+)$')
if not ownerName then if not ownerName then
return false, "Incorrect usage, see /help set_owner." return false, S("Incorrect usage, see /help set_owner.")
end end
local pos1, pos2 = areas:getPos(name) local pos1, pos2 = areas:getPos(name)
if not (pos1 and pos2) then if not (pos1 and pos2) then
return false, "You need to select an area first." return false, S("You need to select an area first.")
end end
if not areas:player_exists(ownerName) then if not areas:player_exists(ownerName) then
return false, "The player \"" return false, S("The player \"@1\" does not exist.", ownerName)
..ownerName.."\" does not exist."
end end
minetest.log("action", name.." runs /set_owner. Owner = "..ownerName.. minetest.log("action", name..S(" runs /set_owner. Owner = ")..ownerName..
" AreaName = "..areaName.. " AreaName = "..areaName..
" StartPos = "..minetest.pos_to_string(pos1).. " StartPos = "..minetest.pos_to_string(pos1)..
" EndPos = " ..minetest.pos_to_string(pos2)) " EndPos = " ..minetest.pos_to_string(pos2))
@ -62,37 +62,36 @@ minetest.register_chatcommand("set_owner", {
areas:save() areas:save()
minetest.chat_send_player(ownerName, minetest.chat_send_player(ownerName,
"You have been granted control over area #".. S("You have been granted control over area #@1. Type /list_areas to show your areas.", id))
id..". Type /list_areas to show your areas.") return true, S("Area protected. ID: ")..id
return true, "Area protected. ID: "..id
end end
}) })
minetest.register_chatcommand("add_owner", { minetest.register_chatcommand("add_owner", {
params = "<ParentID> <Player> <AreaName>", params = "<ParentID> <Player> <AreaName>",
description = "Give a player access to a sub-area beetween two" description = S("Give a player access to a sub-area beetween two"
.." positions that have already been protected," .." positions that have already been protected,"
.." Use set_owner if you don't want the parent to be set.", .." Use set_owner if you don't want the parent to be set."),
func = function(name, param) func = function(name, param)
local pid, ownerName, areaName local pid, ownerName, areaName
= param:match('^(%d+) ([^ ]+) (.+)$') = param:match('^(%d+) ([^ ]+) (.+)$')
if not pid then if not pid then
minetest.chat_send_player(name, "Incorrect usage, see /help add_owner") minetest.chat_send_player(name, S("Incorrect usage, see /help add_owner"))
return return
end end
local pos1, pos2 = areas:getPos(name) local pos1, pos2 = areas:getPos(name)
if not (pos1 and pos2) then if not (pos1 and pos2) then
return false, "You need to select an area first." return false, S("You need to select an area first.")
end end
if not areas:player_exists(ownerName) then if not areas:player_exists(ownerName) then
return false, "The player \""..ownerName.."\" does not exist." return false, S("The player \"@1\" does not exist.", ownerName)
end end
minetest.log("action", name.." runs /add_owner. Owner = "..ownerName.. minetest.log("action", name..S(" runs /add_owner. Owner = ")..ownerName..
" AreaName = "..areaName.." ParentID = "..pid.. " AreaName = "..areaName.." ParentID = "..pid..
" StartPos = "..pos1.x..","..pos1.y..","..pos1.z.. " StartPos = "..pos1.x..","..pos1.y..","..pos1.z..
" EndPos = " ..pos2.x..","..pos2.y..","..pos2.z) " EndPos = " ..pos2.x..","..pos2.y..","..pos2.z)
@ -101,52 +100,51 @@ minetest.register_chatcommand("add_owner", {
pid = tonumber(pid) pid = tonumber(pid)
if (not areas:isAreaOwner(pid, name)) or if (not areas:isAreaOwner(pid, name)) or
(not areas:isSubarea(pos1, pos2, pid)) then (not areas:isSubarea(pos1, pos2, pid)) then
return false, "You can't protect that area." return false, S("You can't protect that area.")
end end
local id = areas:add(ownerName, areaName, pos1, pos2, pid) local id = areas:add(ownerName, areaName, pos1, pos2, pid)
areas:save() areas:save()
minetest.chat_send_player(ownerName, minetest.chat_send_player(ownerName,
"You have been granted control over area #".. S("You have been granted control over area #@1. Type /list_areas to show your areas.", id))
id..". Type /list_areas to show your areas.") return true, S("Area protected. ID: ")..id
return true, "Area protected. ID: "..id
end end
}) })
minetest.register_chatcommand("rename_area", { minetest.register_chatcommand("rename_area", {
params = "<ID> <newName>", params = "<ID> <newName>",
description = "Rename a area that you own", description = S("Rename a area that you own"),
func = function(name, param) func = function(name, param)
local id, newName = param:match("^(%d+)%s(.+)$") local id, newName = param:match("^(%d+)%s(.+)$")
if not id then if not id then
return false, "Invalid usage, see /help rename_area." return false, S("Invalid usage, see /help rename_area.")
end end
id = tonumber(id) id = tonumber(id)
if not id then if not id then
return false, "That area doesn't exist." return false, S("That area doesn't exist.")
end end
if not areas:isAreaOwner(id, name) then if not areas:isAreaOwner(id, name) then
return true, "You don't own that area." return true, S("You don't own that area.")
end end
areas.areas[id].name = newName areas.areas[id].name = newName
areas:save() areas:save()
return true, "Area renamed." return true, S("Area renamed.")
end end
}) })
minetest.register_chatcommand("find_areas", { minetest.register_chatcommand("find_areas", {
params = "<regexp>", params = "<regexp>",
description = "Find areas using a Lua regular expression", description = S("Find areas using a Lua regular expression"),,
privs = areas.adminPrivs, privs = areas.adminPrivs,
func = function(name, param) func = function(name, param)
if param == "" then if param == "" then
return false, "A regular expression is required." return false, S("A regular expression is required.")
end end
-- Check expression for validity -- Check expression for validity
@ -154,7 +152,7 @@ minetest.register_chatcommand("find_areas", {
("Test [1]: Player (0,0,0) (0,0,0)"):find(param) ("Test [1]: Player (0,0,0) (0,0,0)"):find(param)
end end
if not pcall(testRegExp) then if not pcall(testRegExp) then
return false, "Invalid regular expression." return false, S("Invalid regular expression.")
end end
local matches = {} local matches = {}
@ -167,14 +165,14 @@ minetest.register_chatcommand("find_areas", {
if #matches > 0 then if #matches > 0 then
return true, table.concat(matches, "\n") return true, table.concat(matches, "\n")
else else
return true, "No matches found." return true, S("No matches found.")
end end
end end
}) })
minetest.register_chatcommand("list_areas", { minetest.register_chatcommand("list_areas", {
description = "List your areas, or all areas if you are an admin.", description = S("List your areas, or all areas if you are an admin."),
func = function(name, param) func = function(name, param)
local admin = minetest.check_player_privs(name, areas.adminPrivs) local admin = minetest.check_player_privs(name, areas.adminPrivs)
local areaStrings = {} local areaStrings = {}
@ -184,7 +182,7 @@ minetest.register_chatcommand("list_areas", {
end end
end end
if #areaStrings == 0 then if #areaStrings == 0 then
return true, "No visible areas." return true, S("No visible areas.")
end end
return true, table.concat(areaStrings, "\n") return true, table.concat(areaStrings, "\n")
end end
@ -193,149 +191,151 @@ minetest.register_chatcommand("list_areas", {
minetest.register_chatcommand("recursive_remove_areas", { minetest.register_chatcommand("recursive_remove_areas", {
params = "<id>", params = "<id>",
description = "Recursively remove areas using an id", description = S("Recursively remove areas using an id"),
func = function(name, param) func = function(name, param)
local id = tonumber(param) local id = tonumber(param)
if not id then if not id then
return false, "Invalid usage, see" return false, S("Invalid usage, see"
.." /help recursive_remove_areas" .." /help recursive_remove_areas")
end end
if not areas:isAreaOwner(id, name) then if not areas:isAreaOwner(id, name) then
return false, "Area "..id.." does not exist or is" return false, S("Area @1 does not exist or is"
.." not owned by you." .." not owned by you.", id)
end end
areas:remove(id, true) areas:remove(id, true)
areas:save() areas:save()
return true, "Removed area "..id.." and it's sub areas." return true, S("Removed area @1 and it's sub areas.", id)
end end
}) })
minetest.register_chatcommand("remove_area", { minetest.register_chatcommand("remove_area", {
params = "<id>", params = "<id>",
description = "Remove an area using an id", description = S("Remove an area using an id"),
func = function(name, param) func = function(name, param)
local id = tonumber(param) local id = tonumber(param)
if not id then if not id then
return false, "Invalid usage, see /help remove_area" return false, S("Invalid usage, see /help remove_area")
end end
if not areas:isAreaOwner(id, name) then if not areas:isAreaOwner(id, name) then
return false, "Area "..id.." does not exist or" return false, S("Area @1 does not exist or"
.." is not owned by you." .." is not owned by you.", id)
end end
areas:remove(id) areas:remove(id)
areas:save() areas:save()
return true, "Removed area "..id return true, S("Removed area @1", id)
end end
}) })
minetest.register_chatcommand("change_owner", { minetest.register_chatcommand("change_owner", {
params = "<ID> <NewOwner>", params = "<ID> <NewOwner>",
description = "Change the owner of an area using it's ID", description = S("Change the owner of an area using it's ID"),
func = function(name, param) func = function(name, param)
local id, newOwner = param:match("^(%d+)%s(%S+)$") local id, newOwner = param:match("^(%d+)%s(%S+)$")
if not id then if not id then
return false, "Invalid usage, see" return false, S("Invalid usage, see"
.." /help change_owner." .." /help change_owner.")
end end
if not areas:player_exists(newOwner) then if not areas:player_exists(newOwner) then
return false, "The player \""..newOwner return false, S("The player \"@1\" does not exist.", newOwner)
.."\" does not exist."
end end
id = tonumber(id) id = tonumber(id)
if not areas:isAreaOwner(id, name) then if not areas:isAreaOwner(id, name) then
return false, "Area "..id.." does not exist" return false, S("Area @1 does not exist"
.." or is not owned by you." .." or is not owned by you.", id)
end end
areas.areas[id].owner = newOwner areas.areas[id].owner = newOwner
areas:save() areas:save()
minetest.chat_send_player(newOwner, minetest.chat_send_player(newOwner,
("%s has given you control over the area %q (ID %d).") S("@1 has given you control over the area @2 (ID @3).",name, areas.areas[id].name, id))
:format(name, areas.areas[id].name, id)) return true, S("Owner changed.")
return true, "Owner changed."
end end
}) })
minetest.register_chatcommand("area_open", { minetest.register_chatcommand("area_open", {
params = "<ID>", params = "<ID>",
description = "Toggle an area open (anyone can interact) or closed", description = S("Toggle an area open (anyone can interact) or closed"),
func = function(name, param) func = function(name, param)
local id = tonumber(param) local id = tonumber(param)
if not id then if not id then
return false, "Invalid usage, see /help area_open." return false, S("Invalid usage, see /help area_open.")
end end
if not areas:isAreaOwner(id, name) then if not areas:isAreaOwner(id, name) then
return false, "Area "..id.." does not exist" return false, S("Area @1 does not exist"
.." or is not owned by you." .." or is not owned by you.", id)
end end
local open = not areas.areas[id].open local open = not areas.areas[id].open
local open_msg = open and S("opened") or S("closed")
-- Save false as nil to avoid inflating the DB. -- Save false as nil to avoid inflating the DB.
areas.areas[id].open = open or nil areas.areas[id].open = open or nil
areas:save() areas:save()
return true, ("Area %s."):format(open and "opened" or "closed") -- Translators: @1 is one of the previous 'opened' or 'closed'
return true, S("Area @1.", open_msg)
end end
}) })
minetest.register_chatcommand("area_openfarming", { minetest.register_chatcommand("area_openfarming", {
params = "<ID>", params = "<ID>",
description = "Toggle an area open (anyone can interact farming) or closed", description = S("Toggle an area open (anyone can interact farming) or closed"),
func = function(name, param) func = function(name, param)
local id = tonumber(param) local id = tonumber(param)
if not id then if not id then
return false, "Invalid usage, see /help area_openfarming." return false, S("Invalid usage, see /help area_openfarming.")
end end
if not areas:isAreaOwner(id, name) then if not areas:isAreaOwner(id, name) then
return false, "Area "..id.." does not exist" return false, S("Area @1 does not exist"
.." or is not owned by you." .." or is not owned by you.", id)
end end
local openfarming = not areas.areas[id].openfarming local openfarming = not areas.areas[id].openfarming
local openfarming_msg = openfarming and S("opened") or S("closed")
-- Save false as nil to avoid inflating the DB. -- Save false as nil to avoid inflating the DB.
areas.areas[id].openfarming = openfarming or nil areas.areas[id].openfarming = openfarming or nil
areas:save() areas:save()
return true, ("Area %s to farming."):format(openfarming and "opened" or "closed") -- Translators: @1 is one of the previous 'opened' or 'closed'
+ return true, S("Area @1 to farming.", openfarming_msg)
end end
}) })
minetest.register_chatcommand("move_area", { minetest.register_chatcommand("move_area", {
params = "<ID>", params = "<ID>",
description = "Move (or resize) an area to the current positions.", description = S("Move (or resize) an area to the current positions."),
privs = areas.adminPrivs, privs = areas.adminPrivs,
func = function(name, param) func = function(name, param)
local id = tonumber(param) local id = tonumber(param)
if not id then if not id then
return false, "Invalid usage, see /help move_area." return false, S("Invalid usage, see /help move_area.")
end end
local area = areas.areas[id] local area = areas.areas[id]
if not area then if not area then
return false, "Area does not exist." return false, S("Area does not exist.")
end end
local pos1, pos2 = areas:getPos(name) local pos1, pos2 = areas:getPos(name)
if not pos1 then if not pos1 then
return false, "You need to select an area first." return false, S("You need to select an area first.")
end end
areas:move(id, area, pos1, pos2) areas:move(id, area, pos1, pos2)
areas:save() areas:save()
return true, "Area successfully moved." return true, S("Area successfully moved.")
end, end,
}) })
minetest.register_chatcommand("area_info", { minetest.register_chatcommand("area_info", {
description = "Get information about area configuration and usage.", description = S("Get information about area configuration and usage."),
func = function(name, param) func = function(name, param)
local lines = {} local lines = {}
local privs = minetest.get_player_privs(name) local privs = minetest.get_player_privs(name)
@ -358,26 +358,25 @@ minetest.register_chatcommand("area_info", {
size_limit_high or size_limit size_limit_high or size_limit
-- Privilege information -- Privilege information
local self_prot_line = ("Self protection is %sabled"):format( local self_prot_msg = self_prot and S("enabled") or S("disabled")
self_prot and "en" or "dis") -- Translators: @1 is one of the previous 'enabled' or 'disabled'
local self_prot_line = S("Self protection is @1 ", self_prot_msg)
if self_prot and prot_priv then if self_prot and prot_priv then
local has_prot_priv_msg = has_prot_priv and S("and you") or S("but you don't")
-- Translators: @1 is one of the previous 'and you' or 'but you don't'
self_prot_line = self_prot_line.. self_prot_line = self_prot_line..
(" %s have the neccessary privilege (%q).") S(" @1 have the neccessary privilege (@2).", has_prot_priv_msg, prot_priv)
:format(
has_prot_priv and "and you" or
"but you don't",
prot_priv)
else else
self_prot_line = self_prot_line.."." self_prot_line = self_prot_line.."."
end end
table.insert(lines, self_prot_line) table.insert(lines, self_prot_line)
if privs.areas then if privs.areas then
table.insert(lines, "You are an area".. table.insert(lines, S("You are an area"..
" administrator (\"areas\" privilege).") " administrator (\"areas\" privilege)."))
elseif has_high_limit then elseif has_high_limit then
table.insert(lines, table.insert(lines,
"You have extended area protection".. S("You have extended area protection"..
" limits (\"areas_high_limit\" privilege).") " limits (\"areas_high_limit\" privilege)."))
end end
-- Area count -- Area count
@ -387,25 +386,24 @@ minetest.register_chatcommand("area_info", {
area_num = area_num + 1 area_num = area_num + 1
end end
end end
local count_line = ("You have %d area%s"):format( -- Translators: need to use NS gettext to be more precise
area_num, area_num == 1 and "" or "s") local count_line = S("You have @1 area@2", area_num, area_num == 1 and "" or "s")
if privs.areas then if privs.areas then
count_line = count_line.. count_line = count_line..
" and have no area protection limits." S(" and have no area protection limits.")
elseif can_prot then elseif can_prot then
count_line = count_line..(", out of a maximum of %d.") count_line = count_line..S(", out of a maximum of @1.", max_count)
:format(max_count)
end end
table.insert(lines, count_line) table.insert(lines, count_line)
-- Area size limits -- Area size limits
local function size_info(str, size) local function size_info(str, size)
table.insert(lines, ("%s spanning up to %dx%dx%d.") table.insert(lines, (S("%s spanning up to %dx%dx%d."))
:format(str, size.x, size.y, size.z)) :format(str, size.x, size.y, size.z))
end end
local function priv_limit_info(priv, max_count, max_size) local function priv_limit_info(priv, max_count, max_size)
size_info(("Players with the %q privilege".. size_info((S("Players with the %q privilege"
" can protect up to %d areas"):format( .." can protect up to %d areas")):format(
priv, max_count), max_size) priv, max_count), max_size)
end end
if self_prot then if self_prot then
@ -415,7 +413,7 @@ minetest.register_chatcommand("area_info", {
priv_limit_info("areas_high_limit", priv_limit_info("areas_high_limit",
limit_high, size_limit_high) limit_high, size_limit_high)
elseif has_prot_priv then elseif has_prot_priv then
size_info("You can protect areas", max_size) size_info(S("You can protect areas"), max_size)
end end
end end
@ -427,56 +425,56 @@ minetest.register_chatcommand("area_info", {
+minetest.register_chatcommand("area_addspawn", { +minetest.register_chatcommand("area_addspawn", {
params = "<ID>", params = "<ID>",
privs = areas.adminPrivs, privs = areas.adminPrivs,
description = "Define special spawn for area", description = S("Define special spawn for area"),
func = function(name, param) func = function(name, param)
local id = param:match("^(%d+)") local id = param:match("^(%d+)")
if not id then if not id then
return false, "Invalid usage, see /help area_addspawn." return false, S("Invalid usage, see /help area_addspawn.")
end end
id = tonumber(id) id = tonumber(id)
if not id then if not id then
return false, "Error, Param id must be int." return false, S("Error, Param id must be int.")
end end
local player = minetest.get_player_by_name(name) local player = minetest.get_player_by_name(name)
if not player then if not player then
return false, "Error, there is not player" return false, S("Error, there is not such player")
end end
local pos = player:getpos() local pos = player:getpos()
if not pos then if not pos then
return false, "Error, there is not pos." return false, S("Error, there is not pos.")
end end
if not areas.areas[id] then if not areas.areas[id] then
return false, "Area ".. id .." does not exist." return false, S("Area @1 does not exist.", id)
end end
areas.areas[id].spawn = pos areas.areas[id].spawn = pos
areas:save() areas:save()
return true, "spawn of area ".. id .." defined." return true, S("spawn of area @1 defined.", id)
end end
}) })
minetest.register_chatcommand("area_delspawn", { minetest.register_chatcommand("area_delspawn", {
params = "<ID>", params = "<ID>",
privs = areas.adminPrivs, privs = areas.adminPrivs,
description = "Delete special spawn of area", description = S("Delete special spawn of area"),
func = function(name, param) func = function(name, param)
local id = param:match("^(%d+)") local id = param:match("^(%d+)")
if not id then if not id then
return false, "Invalid usage, see /help area_delspawn." return false, S("Invalid usage, see /help area_delspawn.")
end end
id = tonumber(id) id = tonumber(id)
if not id then if not id then
return false, "Error, Param id must be int." return false, S("Error, Param id must be int.")
end end
if not areas.areas[id] then if not areas.areas[id] then
return false, "Area ".. id .." does not exist." return false, S("Area @1 does not exist.", id)
end end
areas.areas[id].spawn = nil areas.areas[id].spawn = nil
areas:save() areas:save()
return true, "spawn of area ".. id .." deleted." return true, S("spawn of area @1 deleted.", id)
end end
}) })

1
depends.txt Normal file
View File

@ -0,0 +1 @@
intllib?

View File

@ -1,4 +1,5 @@
-- This is inspired by the landrush mod by Bremaweb -- This is inspired by the landrush mod by Bremaweb
local S = areas.intllib
areas.hud = {} areas.hud = {}
@ -6,7 +7,7 @@ local function tick()
for _, player in pairs(minetest.get_connected_players()) do for _, player in pairs(minetest.get_connected_players()) do
local name = player:get_player_name() local name = player:get_player_name()
local pos = vector.round(player:getpos()) local pos = vector.round(player:getpos())
local area_text = "No area(s)\n\n" local area_text = S("No area(s)").."\n\n"
local area_owner_name = "" local area_owner_name = ""
local mod_owner = 0 local mod_owner = 0
local mod_open = 0 local mod_open = 0
@ -47,7 +48,8 @@ local function tick()
if nb_areas > 1 then if nb_areas > 1 then
plural = "s" plural = "s"
end end
area_text = ("%s\nOwner: %s\n%u area" .. plural):format(area_name, area_owner_name, nb_areas) -- Translators: need to use NS gettext to be more precise
area_text = (S("%s\nOwner: %s\n%u area") .. plural):format(area_name, area_owner_name, nb_areas)
icon = ("areas_%u_%u_%u.png"):format(mod_owner, mod_open, mod_farming) icon = ("areas_%u_%u_%u.png"):format(mod_owner, mod_open, mod_farming)
end end
if not areas.hud[name] then if not areas.hud[name] then

View File

@ -4,6 +4,11 @@
areas = {} areas = {}
-- Load support for intllib.
local MP = minetest.get_modpath(minetest.get_current_modname())
local S, NS = dofile(MP.."/intllib.lua")
areas.intllib = S
areas.adminPrivs = {areas=true} areas.adminPrivs = {areas=true}
areas.startTime = os.clock() areas.startTime = os.clock()
@ -20,20 +25,20 @@ dofile(areas.modpath.."/hud.lua")
areas:load() areas:load()
minetest.register_privilege("areas", { minetest.register_privilege("areas", {
description = "Can administer areas." description = S("Can administer areas.")
}) })
minetest.register_privilege("areas_high_limit", { minetest.register_privilege("areas_high_limit", {
description = "Can can more, bigger areas." description = S("Can can more, bigger areas.")
}) })
if not minetest.registered_privileges[areas.config.self_protection_privilege] then if not minetest.registered_privileges[areas.config.self_protection_privilege] then
minetest.register_privilege(areas.config.self_protection_privilege, { minetest.register_privilege(areas.config.self_protection_privilege, {
description = "Can protect areas.", description = S("Can protect areas."),
}) })
end end
if minetest.settings:get_bool("log_mod") then if minetest.settings:get_bool("log_mod") then
local diffTime = os.clock() - areas.startTime local diffTime = os.clock() - areas.startTime
minetest.log("action", "areas loaded in "..diffTime.."s.") minetest.log("action", S("[MOD]areas loaded in @1s.", diffTime))
end end

View File

@ -1,5 +1,4 @@
local MP = minetest.get_modpath(minetest.get_current_modname()) local S = areas.intllib
local S, NS = dofile(MP.."/intllib.lua")
local old_is_protected = minetest.is_protected local old_is_protected = minetest.is_protected
function minetest.is_protected(pos, name) function minetest.is_protected(pos, name)
@ -14,8 +13,8 @@ minetest.register_on_protection_violation(function(pos, name)
local playerpos = player:getpos() local playerpos = player:getpos()
if not areas:canInteract(pos, name) then if not areas:canInteract(pos, name) then
local owners = areas:getNodeOwners(pos) local owners = areas:getNodeOwners(pos)
--minetest.chat_send_player(name, ("%s is protected by %s."):format(minetest.pos_to_string(pos), table.concat(owners, ", "))) --minetest.chat_send_player(name, (S("%s is protected by %s.")):format(minetest.pos_to_string(pos), table.concat(owners, ", ")))
minetest.chat_send_player(name,S("@1 is protected by @2",minetest.pos_to_string(pos),table.concat(owners, ", "))) minetest.chat_send_player(name,(S("%s is protected by %s.")),minetest.pos_to_string(pos),table.concat(owners, ", ")))
minetest.after(1,anti_lag,{player=player,playerpos=playerpos}) minetest.after(1,anti_lag,{player=player,playerpos=playerpos})
end end
end) end)

View File

@ -1,5 +1,7 @@
local S = areas.intllib
-- Mega_builder privilege -- Mega_builder privilege
minetest.register_privilege("megabuilder","Can protect an infinite amount of areas.") minetest.register_privilege("megabuilder",S("Can protect an infinite amount of areas."))
function areas:player_exists(name) function areas:player_exists(name)
return minetest.get_auth_handler().get_auth(name) ~= nil return minetest.get_auth_handler().get_auth(name) ~= nil
@ -21,7 +23,7 @@ end
function areas:save() function areas:save()
local datastr = minetest.serialize(self.areas) local datastr = minetest.serialize(self.areas)
if not datastr then if not datastr then
minetest.log("error", "[areas] Failed to serialize area data!") minetest.log("error", S("[areas] Failed to serialize area data!"))
return return
end end
return safe_file_write(self.config.filename, datastr) return safe_file_write(self.config.filename, datastr)
@ -48,8 +50,8 @@ end
-- @return Whether the ID was valid. -- @return Whether the ID was valid.
function areas:checkAreaStoreId(sid) function areas:checkAreaStoreId(sid)
if not sid then if not sid then
minetest.log("error", "AreaStore failed to find an ID for an " minetest.log("error", S("AreaStore failed to find an ID for an "
.."area! Falling back to iterative area checking.") .."area! Falling back to iterative area checking."))
self.store = nil self.store = nil
self.store_ids = nil self.store_ids = nil
end end
@ -200,8 +202,8 @@ function areas:canPlayerAddArea(pos1, pos2, name)
-- and if the area is too big. -- and if the area is too big.
if not self.config.self_protection or if not self.config.self_protection or
not privs[areas.config.self_protection_privilege] then not privs[areas.config.self_protection_privilege] then
return false, "Self protection is disabled or you do not have" return false, S("Self protection is disabled or you do not have"
.." the necessary privilege." .." the necessary privilege.")
end end
-- MFF: megabuilders skip checks on size and number of areas. -- MFF: megabuilders skip checks on size and number of areas.
@ -214,7 +216,7 @@ function areas:canPlayerAddArea(pos1, pos2, name)
(pos2.x - pos1.x) > max_size.x or (pos2.x - pos1.x) > max_size.x or
(pos2.y - pos1.y) > max_size.y or (pos2.y - pos1.y) > max_size.y or
(pos2.z - pos1.z) > max_size.z then (pos2.z - pos1.z) > max_size.z then
return false, "Area is too big." return false, S("Area is too big.")
end end
-- Check number of areas the user has and make sure it not above the max -- Check number of areas the user has and make sure it not above the max
@ -228,8 +230,8 @@ function areas:canPlayerAddArea(pos1, pos2, name)
self.config.self_protection_max_areas_high or self.config.self_protection_max_areas_high or
self.config.self_protection_max_areas self.config.self_protection_max_areas
if count >= max_areas then if count >= max_areas then
return false, "You have reached the maximum amount of" return false, S("You have reached the maximum amount of"
.." areas that you are allowed to protect." .." areas that you are allowed to protect.")
end end
end end
end end
@ -238,7 +240,7 @@ end
local can, id = self:canMakeArea(pos1, pos2, name) --MFF crabman(25/02/2016) fix areas in areas local can, id = self:canMakeArea(pos1, pos2, name) --MFF crabman(25/02/2016) fix areas in areas
if not can then if not can then
local area = self.areas[id] local area = self.areas[id]
return false, ("The area intersects with %s [%u] (%s).") return false, (S("The area intersects with %s [%u] (%s)."))
:format(area.name, id, area.owner) :format(area.name, id, area.owner)
end end

View File

@ -1,25 +1,27 @@
-- This file contains functions to convert from -- This file contains functions to convert from
-- the old areas format and other compatability code. -- the old areas format and other compatability code.
local S = areas.intllib
minetest.register_chatcommand("legacy_load_areas", { minetest.register_chatcommand("legacy_load_areas", {
params = "<version>", params = "<version>",
description = "Loads, converts, and saves the areas from" description = S("Loads, converts, and saves the areas from"
.." a legacy save file.", .." a legacy save file."),
privs = {areas=true, server=true}, privs = {areas=true, server=true},
func = function(name, param) func = function(name, param)
minetest.chat_send_player(name, "Converting areas...") minetest.chat_send_player(name, S("Converting areas..."))
local version = tonumber(param) local version = tonumber(param)
if version == 0 then if version == 0 then
err = areas:node_ownership_load() err = areas:node_ownership_load()
if err then if err then
minetest.chat_send_player(name, "Error loading legacy file: "..err) minetest.chat_send_player(name, S("Error loading legacy file: ")..err)
return return
end end
else else
minetest.chat_send_player(name, "Invalid version number. (0 allowed)") minetest.chat_send_player(name, S("Invalid version number. (0 allowed)"))
return return
end end
minetest.chat_send_player(name, "Legacy file loaded.") minetest.chat_send_player(name, S("Legacy file loaded."))
for k, area in pairs(areas.areas) do for k, area in pairs(areas.areas) do
-- New position format -- New position format
@ -34,15 +36,15 @@ minetest.register_chatcommand("legacy_load_areas", {
areas:sortPos(area.pos1, area.pos2) areas:sortPos(area.pos1, area.pos2)
-- Add name -- Add name
area.name = "unnamed" area.name = S("unnamed")
-- Remove ID -- Remove ID
area.id = nil area.id = nil
end end
minetest.chat_send_player(name, "Table format updated.") minetest.chat_send_player(name, S("Table format updated."))
areas:save() areas:save()
minetest.chat_send_player(name, "Converted areas saved. Done.") minetest.chat_send_player(name, S("Converted areas saved. Done."))
end end
}) })
@ -129,7 +131,7 @@ if areas.config.legacy_table then
{x=a.x2, y=a.y2, z=a.z2} {x=a.x2, y=a.y2, z=a.z2}
a.x1, a.y1, a.z1, a.x2, a.y2, a.z2 = a.x1, a.y1, a.z1, a.x2, a.y2, a.z2 =
nil, nil, nil, nil, nil, nil nil, nil, nil, nil, nil, nil
a.name = a.name or "unnamed" a.name = a.name or S("unnamed")
a.id = nil a.id = nil
return rawset(areas.areas, key, a) return rawset(areas.areas, key, a)
end end

View File

@ -7,9 +7,9 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: \n" "Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2018-01-29 11:28+0200\n" "POT-Creation-Date: 2017-08-02 14:48+0200\n"
"PO-Revision-Date: 2018-01-29 09:18+0200\n" "PO-Revision-Date: 2017-08-02 15:35+0200\n"
"Last-Translator: \n" "Last-Translator: fat115 <fat115@framasoft.org>\n"
"Language-Team: \n" "Language-Team: \n"
"Language: fr\n" "Language: fr\n"
"MIME-Version: 1.0\n" "MIME-Version: 1.0\n"
@ -18,6 +18,503 @@ msgstr ""
"X-Generator: Poedit 1.8.12\n" "X-Generator: Poedit 1.8.12\n"
"Plural-Forms: nplurals=2; plural=(n > 1);\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n"
#: chatcommands.lua
msgid "Protect your own area"
msgstr "Protéger votre zone"
#: chatcommands.lua
msgid "Invalid usage, see /help protect."
msgstr "Usage incorrect, consultez /help protect"
#: chatcommands.lua
msgid "You need to select an area first."
msgstr "Vous devez d'abord sélectionner une zone."
#: chatcommands.lua
msgid "/protect invoked, Owner ="
msgstr "/protect invoqué, Propriétaire ="
#: chatcommands.lua
msgid "You can't protect that area: "
msgstr "Vous ne pouvez pas protéger cette zone : "
#: chatcommands.lua
msgid "Area protected. ID: "
msgstr "La zone est désormais protégée. Elle porte le N°"
#: chatcommands.lua
msgid ""
"Protect an area beetween two positions and give a player access to it "
"without setting the parent of the area to any existing area"
msgstr ""
"Protéger la zone entre deux positions et en donner l'accès à un joueur sans "
"définir de parent pour cette zone."
#: chatcommands.lua
msgid "Incorrect usage, see /help set_owner."
msgstr "Usage incorrect, consultez /help set_owner"
#: chatcommands.lua
msgid "The player \"@1\" does not exist."
msgstr "Le joueur \"@1\" n'existe pas."
#: chatcommands.lua
msgid " runs /set_owner. Owner = "
msgstr " a lancé /set_owner. Propriétaire = "
#: chatcommands.lua
msgid ""
"You have been granted control over area #@1. Type /list_areas to show your "
"areas."
msgstr ""
"Vous avez le contrôle sur la zone N°@1. Tapez /list pour voir la liste de "
"vos zones."
#: chatcommands.lua
msgid ""
"Give a player access to a sub-area beetween two positions that have already "
"been protected, Use set_owner if you don't want the parent to be set."
msgstr ""
"Donne l'accès à un joueur pour la zone comprise entre deux positions déja "
"protégée. Utilisez plutot set_owner si vous ne souhaitez pas définir le "
"parent."
#: chatcommands.lua
msgid "Incorrect usage, see /help add_owner"
msgstr "Usage incorrect, consultez /help add_owner"
#: chatcommands.lua
msgid " runs /add_owner. Owner = "
msgstr " a lancé /add_owner. Propriétaire = "
#: chatcommands.lua
msgid "You can't protect that area."
msgstr "Vous ne pouvez pas protéger cette zone."
#: chatcommands.lua
msgid "Rename a area that you own"
msgstr "Renommer une zone que vous possédez"
#: chatcommands.lua
msgid "Invalid usage, see /help rename_area."
msgstr "Usage incorrect, consultez /help rename_area."
#: chatcommands.lua
msgid "That area doesn't exist."
msgstr "Cette zone n'existe pas."
#: chatcommands.lua
msgid "You don't own that area."
msgstr "Vous ne possédez pas cette zone."
#: chatcommands.lua
msgid "Area renamed."
msgstr "Zone renommée."
#: chatcommands.lua
msgid "Find areas using a Lua regular expression"
msgstr "Rechercher des zones en utilisant une expression régulière Lua"
#: chatcommands.lua
msgid "A regular expression is required."
msgstr "Une expression régulière est requise."
#: chatcommands.lua
msgid "Invalid regular expression."
msgstr "Expression régulière invalide."
#: chatcommands.lua
msgid "No matches found."
msgstr "Aucun résultat."
#: chatcommands.lua
msgid "List your areas, or all areas if you are an admin."
msgstr "Affiche vos zones (ou toutes les zones si vous êtes administrateur)."
#: chatcommands.lua
msgid "No visible areas."
msgstr "Aucune zone visible."
#: chatcommands.lua
msgid "Recursively remove areas using an id"
msgstr "Supprimer récursivement des zones en utilisant un numéro"
#: chatcommands.lua
msgid "Invalid usage, see /help recursive_remove_areas"
msgstr "Usage incorrect, consultez /help recursive_remove_areas"
#: chatcommands.lua
msgid "Area @1 does not exist or is not owned by you."
msgstr "La zone @1 n'existe pas ou ne vous appartient pas."
#: chatcommands.lua
msgid "Removed area @1 and it's sub areas."
msgstr "Zone @1 supprimée ainsi que toutes ses sous-zones."
#: chatcommands.lua
msgid "Remove an area using an id"
msgstr "Supprimer une zone en utilisant son numéro"
#: chatcommands.lua
msgid "Invalid usage, see /help remove_area"
msgstr "Usage incorrect, consultez /help remove_area"
#: chatcommands.lua
msgid "Removed area @1"
msgstr "Zone @1 supprimée"
#: chatcommands.lua
msgid "Change the owner of an area using it's ID"
msgstr "Modifier le propriétaire d'une zone en utilisant son numéro"
#: chatcommands.lua
msgid "Invalid usage, see /help change_owner."
msgstr "Usage incorrect, consultez /help change_owner."
#: chatcommands.lua
msgid "@1 has given you control over the area @2 (ID @3)."
msgstr "@1 vous a donné le contrôle sur la zone @2 (N° @3)."
#: chatcommands.lua
msgid "Owner changed."
msgstr "Propriétaire modifié."
#: chatcommands.lua
msgid "Toggle an area open (anyone can interact) or closed"
msgstr ""
"Bascule une zone en mode ouvert (nimporte qui peut interagir) ou fermé"
#: chatcommands.lua
msgid "Invalid usage, see /help area_open."
msgstr "Usage incorrect, consultez /help area_open."
#: chatcommands.lua
msgid "closed"
msgstr "fermée"
#: chatcommands.lua
msgid "opened"
msgstr "ouverte"
#. Translators: @1 is one of the previous 'opened' or 'closed'
#: chatcommands.lua
msgid "Area @1."
msgstr "Zone @1."
#: chatcommands.lua
msgid "Toggle an area open (anyone can interact farming) or closed"
msgstr ""
"Bascule une zone en mode culture ouverte (nimporte qui peut cultiver) ou "
"fermée"
#: chatcommands.lua
msgid "Invalid usage, see /help area_openfarming."
msgstr "Usage incorrect, consultez /help area_openfarming."
#. Translators: @1 is one of the previous 'opened' or 'closed'
#: chatcommands.lua
msgid "Area @1 to farming."
msgstr "Zone @1 à la culture."
#: chatcommands.lua
msgid "Move (or resize) an area to the current positions."
msgstr "Déplace (ou redimensionne) une zone avec les positions actuelles."
#: chatcommands.lua
msgid "Invalid usage, see /help move_area."
msgstr "Usage incorrect, consultez /help move_area"
#: chatcommands.lua
msgid "Area does not exist."
msgstr "La zone n'existe pas."
#: chatcommands.lua
msgid "Area successfully moved."
msgstr "La zone a été déplacée."
#: chatcommands.lua
msgid "Get information about area configuration and usage."
msgstr "Affiche les informations sur la configuration des zones et leur usage."
#: chatcommands.lua
msgid "disabled"
msgstr "désactivée"
#: chatcommands.lua
msgid "enabled"
msgstr "activée"
#. Translators: @1 is one of the previous 'enabled' or 'disabled'
#: chatcommands.lua
msgid "Self protection is @1 "
msgstr "L'auto-protection est @1 "
#: chatcommands.lua
msgid "and you"
msgstr "et vous avez"
#: chatcommands.lua
msgid "but you don't"
msgstr "mais vous n'avez pas"
#. Translators: @1 is one of the previous 'and you' or 'but you don't'
#: chatcommands.lua
msgid " @1 have the neccessary privilege (@2)."
msgstr " @1 le privilège requis (@2)."
#: chatcommands.lua
msgid "You are an area administrator (\"areas\" privilege)."
msgstr "Vous êtes administrateur de zones (privilège \\\"areas\\\" )."
#: chatcommands.lua
msgid ""
"You have extended area protection limits (\"areas_high_limit\" privilege)."
msgstr ""
"Vous pouvez protéger de grandes zones (privilège \\\"areas_high_limit\\\")."
#. Translators: need to use NS gettext to be more precise
#: chatcommands.lua
msgid "You have @1 area@2"
msgstr "Vous êtes propriétaire de @1 zone@2"
#: chatcommands.lua
msgid " and have no area protection limits."
msgstr " et n'avez pas de limite de protection de zones."
#: chatcommands.lua
msgid ", out of a maximum of @1."
msgstr ", sur un maximum de @1."
#: chatcommands.lua
#, lua-format
msgid "%s spanning up to %dx%dx%d."
msgstr "%s étendue jusquà %dx%dx%d."
#: chatcommands.lua
#, lua-format
msgid "Players with the %q privilege can protect up to %d areas"
msgstr "Les joueurs avec le privilège %q peuvent protéger jusqu'à %d zones"
#: chatcommands.lua
msgid "You can protect areas"
msgstr "Vous pouvez protéger des zones"
#: chatcommands.lua
msgid "Define special spawn for area"
msgstr "Définit un spawn spécifique à une zone"
#: chatcommands.lua
msgid "Invalid usage, see /help area_addspawn."
msgstr "Usage incorrect, consultez /help area_addspawn."
#: chatcommands.lua
msgid "Error, Param id must be int."
msgstr "Erreur, le paramètre id doit être un entier"
#: chatcommands.lua
msgid "Error, there is not such player"
msgstr "Erreur, pas de joueur à ce nom"
#: chatcommands.lua
msgid "Error, there is not pos."
msgstr "Erreur, position invalide."
#: chatcommands.lua
msgid "Area @1 does not exist."
msgstr "La zone @1 n'existe pas."
#: chatcommands.lua
msgid "spawn of area @1 defined."
msgstr "spawn de la zone @1 défini."
#: chatcommands.lua
msgid "Delete special spawn of area"
msgstr "Supprime le spawn spécifique à une zone"
#: chatcommands.lua
msgid "Invalid usage, see /help area_delspawn."
msgstr "Usage incorrect, consultez /help area_delspawn."
#: chatcommands.lua
msgid "spawn of area @1 deleted."
msgstr "spawn de la zone @1 supprimé."
#: hud.lua
msgid "No area(s)"
msgstr "Pas de zone"
#. Translators: need to use NS gettext to be more precise
#: hud.lua
#, lua-format
msgid ""
"%s\n"
"Owner: %s\n"
"%u area"
msgstr ""
"%s\n"
"Propriétaire : %s\n"
"%u zone"
#: init.lua #: init.lua
msgid "@1 is protected by @2" msgid "Can administer areas."
msgstr "@1 est protégé par @2" msgstr "Droit dadministrer des zones"
#: init.lua
msgid "Can can more, bigger areas."
msgstr "Droit de créer des zones plus grandes."
#: init.lua
msgid "Can protect areas."
msgstr "Droit de protéger des zones."
#: init.lua
msgid "[MOD]areas loaded in @1s."
msgstr "[MOD]areas chargé en @1s."
#: interact.lua
#, lua-format
msgid "%s is protected by %s."
msgstr "%s est protégée par %s"
#: internal.lua
msgid "Self protection is disabled or you do not have the necessary privilege."
msgstr ""
"L'auto-protection est désactivée ou vous n'avez pas les privilèges requis."
#: internal.lua
msgid "Area is too big."
msgstr "La zone est trop grande."
#: internal.lua
msgid ""
"You have reached the maximum amount of areas that you are allowed to protect."
msgstr ""
"Vous avez atteint le nombre maximum de zones que vous êtes autorisé a "
"protéger."
#: internal.lua
#, lua-format
msgid "The area intersects with %s [%u] (%s)."
msgstr "Cette zone se recoupe avec %s [%u] (%s)."
#: legacy.lua
msgid "Loads, converts, and saves the areas from a legacy save file."
msgstr "Charge, convertit et sauvegarde les zones depuis un ancien fichier"
#: legacy.lua
msgid "Converting areas..."
msgstr "Conversion des zones..."
#: legacy.lua
msgid "Error loading legacy file: "
msgstr "Erreur de chargement du fichier : "
#: legacy.lua
msgid "Invalid version number. (0 allowed)"
msgstr "Numéro de version incorrect. (0 autorisé)"
#: legacy.lua
msgid "Legacy file loaded."
msgstr "Ancien fichier chargé."
#: legacy.lua
msgid "unnamed"
msgstr "sans nom"
#: legacy.lua
msgid "Table format updated."
msgstr "Format de table mis à jour."
#: legacy.lua
msgid "Converted areas saved. Done."
msgstr "Zones converties sauvegardées. Terminé."
#: pos.lua
msgid "Select a area by id."
msgstr "Sélectionnez une zone par son numéro"
#: pos.lua
msgid "Invalid usage, see /help select_area."
msgstr "Usage incorrect, consultez /help select_area."
#: pos.lua
msgid "The area @1 does not exist."
msgstr "La zone @1 n'existe pas."
#: pos.lua
msgid "Area @1 selected."
msgstr "La zone @1 est sélectionnée."
#: pos.lua
msgid ""
"Set area protection region position 1 to your location or the one specified"
msgstr ""
"Définit la position 1 de la zone à protéger à votre position ou à celle "
"spécifiée"
#: pos.lua
msgid "Unable to get position."
msgstr "Impossible d'utiliser cette position."
#: pos.lua
msgid "Invalid usage, see /help area_pos1."
msgstr "Usage incorect, consultez /help area_pos1."
#: pos.lua
msgid "Area position 1 set to "
msgstr "Position 1 de la zone définie en "
#: pos.lua
msgid ""
"Set area protection region position 2 to your location or the one specified"
msgstr ""
"Définit la position 2 de la zone à protéger à votre position ou à celle "
"spécifiée"
#: pos.lua
msgid "Invalid usage, see /help area_pos2."
msgstr "Usage incorrect, consultez /help area_pos2."
#: pos.lua
msgid "Area position 2 set to "
msgstr "Position 2 de la zone définie en "
#: pos.lua
msgid ""
"Set area protection region, position 1, or position 2 by punching nodes, or "
"display the region"
msgstr ""
"Définit la région de votre zone protégée, position 1 ou position 2 en tapant "
"sur un bloc ou, affiche la région"
#: pos.lua
msgid "Select positions by punching two nodes."
msgstr "Tapez sur deux blocs pour sélectionner les positions."
#: pos.lua
msgid "Select position 1 by punching a node."
msgstr "Choisissez la position 1 en tapant sur un bloc."
#: pos.lua
msgid "Select position 2 by punching a node."
msgstr "Choisissez la position 2 en tapant sur un bloc."
#: pos.lua
msgid "<not set>"
msgstr "<non défini>"
#: pos.lua
msgid "Unknown subcommand: "
msgstr "Sous-commande inconnue : "
#: pos.lua
msgid "Position 1 set to "
msgstr "Position 1 définie en "
#: pos.lua
msgid "Position 2 set to "
msgstr "Position 2 définie en "
#: settings.lua
msgid "Invalid setting type!"
msgstr "Type de réglage invalide !"

496
locale/template.pot Normal file
View File

@ -0,0 +1,496 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-08-02 14:48+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=CHARSET\n"
"Content-Transfer-Encoding: 8bit\n"
#: chatcommands.lua
msgid "Protect your own area"
msgstr ""
#: chatcommands.lua
msgid "Invalid usage, see /help protect."
msgstr ""
#: chatcommands.lua
msgid "You need to select an area first."
msgstr ""
#: chatcommands.lua
msgid "/protect invoked, Owner ="
msgstr ""
#: chatcommands.lua
msgid "You can't protect that area: "
msgstr ""
#: chatcommands.lua
msgid "Area protected. ID: "
msgstr ""
#: chatcommands.lua
msgid ""
"Protect an area beetween two positions and give a player access to it "
"without setting the parent of the area to any existing area"
msgstr ""
#: chatcommands.lua
msgid "Incorrect usage, see /help set_owner."
msgstr ""
#: chatcommands.lua
msgid "The player \"@1\" does not exist."
msgstr ""
#: chatcommands.lua
msgid " runs /set_owner. Owner = "
msgstr ""
#: chatcommands.lua
msgid ""
"You have been granted control over area #@1. Type /list_areas to show your "
"areas."
msgstr ""
#: chatcommands.lua
msgid ""
"Give a player access to a sub-area beetween two positions that have already "
"been protected, Use set_owner if you don't want the parent to be set."
msgstr ""
#: chatcommands.lua
msgid "Incorrect usage, see /help add_owner"
msgstr ""
#: chatcommands.lua
msgid " runs /add_owner. Owner = "
msgstr ""
#: chatcommands.lua
msgid "You can't protect that area."
msgstr ""
#: chatcommands.lua
msgid "Rename a area that you own"
msgstr ""
#: chatcommands.lua
msgid "Invalid usage, see /help rename_area."
msgstr ""
#: chatcommands.lua
msgid "That area doesn't exist."
msgstr ""
#: chatcommands.lua
msgid "You don't own that area."
msgstr ""
#: chatcommands.lua
msgid "Area renamed."
msgstr ""
#: chatcommands.lua
msgid "Find areas using a Lua regular expression"
msgstr ""
#: chatcommands.lua
msgid "A regular expression is required."
msgstr ""
#: chatcommands.lua
msgid "Invalid regular expression."
msgstr ""
#: chatcommands.lua
msgid "No matches found."
msgstr ""
#: chatcommands.lua
msgid "List your areas, or all areas if you are an admin."
msgstr ""
#: chatcommands.lua
msgid "No visible areas."
msgstr ""
#: chatcommands.lua
msgid "Recursively remove areas using an id"
msgstr ""
#: chatcommands.lua
msgid "Invalid usage, see /help recursive_remove_areas"
msgstr ""
#: chatcommands.lua
msgid "Area @1 does not exist or is not owned by you."
msgstr ""
#: chatcommands.lua
msgid "Removed area @1 and it's sub areas."
msgstr ""
#: chatcommands.lua
msgid "Remove an area using an id"
msgstr ""
#: chatcommands.lua
msgid "Invalid usage, see /help remove_area"
msgstr ""
#: chatcommands.lua
msgid "Removed area @1"
msgstr ""
#: chatcommands.lua
msgid "Change the owner of an area using it's ID"
msgstr ""
#: chatcommands.lua
msgid "Invalid usage, see /help change_owner."
msgstr ""
#: chatcommands.lua
msgid "@1 has given you control over the area @2 (ID @3)."
msgstr ""
#: chatcommands.lua
msgid "Owner changed."
msgstr ""
#: chatcommands.lua
msgid "Toggle an area open (anyone can interact) or closed"
msgstr ""
#: chatcommands.lua
msgid "Invalid usage, see /help area_open."
msgstr ""
#: chatcommands.lua
msgid "closed"
msgstr ""
#: chatcommands.lua
msgid "opened"
msgstr ""
#. Translators: @1 is one of the previous 'opened' or 'closed'
#: chatcommands.lua
msgid "Area @1."
msgstr ""
#: chatcommands.lua
msgid "Toggle an area open (anyone can interact farming) or closed"
msgstr ""
#: chatcommands.lua
msgid "Invalid usage, see /help area_openfarming."
msgstr ""
#. Translators: @1 is one of the previous 'opened' or 'closed'
#: chatcommands.lua
msgid "Area @1 to farming."
msgstr ""
#: chatcommands.lua
msgid "Move (or resize) an area to the current positions."
msgstr ""
#: chatcommands.lua
msgid "Invalid usage, see /help move_area."
msgstr ""
#: chatcommands.lua
msgid "Area does not exist."
msgstr ""
#: chatcommands.lua
msgid "Area successfully moved."
msgstr ""
#: chatcommands.lua
msgid "Get information about area configuration and usage."
msgstr ""
#: chatcommands.lua
msgid "disabled"
msgstr ""
#: chatcommands.lua
msgid "enabled"
msgstr ""
#. Translators: @1 is one of the previous 'enabled' or 'disabled'
#: chatcommands.lua
msgid "Self protection is @1 "
msgstr ""
#: chatcommands.lua
msgid "and you"
msgstr ""
#: chatcommands.lua
msgid "but you don't"
msgstr ""
#. Translators: @1 is one of the previous 'and you' or 'but you don't'
#: chatcommands.lua
msgid " @1 have the neccessary privilege (@2)."
msgstr ""
#: chatcommands.lua
msgid "You are an area administrator (\"areas\" privilege)."
msgstr ""
#: chatcommands.lua
msgid ""
"You have extended area protection limits (\"areas_high_limit\" privilege)."
msgstr ""
#. Translators: need to use NS gettext to be more precise
#: chatcommands.lua
msgid "You have @1 area@2"
msgstr ""
#: chatcommands.lua
msgid " and have no area protection limits."
msgstr ""
#: chatcommands.lua
msgid ", out of a maximum of @1."
msgstr ""
#: chatcommands.lua
#, lua-format
msgid "%s spanning up to %dx%dx%d."
msgstr ""
#: chatcommands.lua
#, lua-format
msgid "Players with the %q privilege can protect up to %d areas"
msgstr ""
#: chatcommands.lua
msgid "You can protect areas"
msgstr ""
#: chatcommands.lua
msgid "Define special spawn for area"
msgstr ""
#: chatcommands.lua
msgid "Invalid usage, see /help area_addspawn."
msgstr ""
#: chatcommands.lua
msgid "Error, Param id must be int."
msgstr ""
#: chatcommands.lua
msgid "Error, there is not such player"
msgstr ""
#: chatcommands.lua
msgid "Error, there is not pos."
msgstr ""
#: chatcommands.lua
msgid "Area @1 does not exist."
msgstr ""
#: chatcommands.lua
msgid "spawn of area @1 defined."
msgstr ""
#: chatcommands.lua
msgid "Delete special spawn of area"
msgstr ""
#: chatcommands.lua
msgid "Invalid usage, see /help area_delspawn."
msgstr ""
#: chatcommands.lua
msgid "spawn of area @1 deleted."
msgstr ""
#: hud.lua
msgid "No area(s)"
msgstr ""
#. Translators: need to use NS gettext to be more precise
#: hud.lua
#, lua-format
msgid ""
"%s\n"
"Owner: %s\n"
"%u area"
msgstr ""
#: init.lua
msgid "Can administer areas."
msgstr ""
#: init.lua
msgid "Can can more, bigger areas."
msgstr ""
#: init.lua
msgid "Can protect areas."
msgstr ""
#: init.lua
msgid "[MOD]areas loaded in @1s."
msgstr ""
#: interact.lua
#, lua-format
msgid "%s is protected by %s."
msgstr ""
#: internal.lua
msgid "Self protection is disabled or you do not have the necessary privilege."
msgstr ""
#: internal.lua
msgid "Area is too big."
msgstr ""
#: internal.lua
msgid ""
"You have reached the maximum amount of areas that you are allowed to protect."
msgstr ""
#: internal.lua
#, lua-format
msgid "The area intersects with %s [%u] (%s)."
msgstr ""
#: legacy.lua
msgid "Loads, converts, and saves the areas from a legacy save file."
msgstr ""
#: legacy.lua
msgid "Converting areas..."
msgstr ""
#: legacy.lua
msgid "Error loading legacy file: "
msgstr ""
#: legacy.lua
msgid "Invalid version number. (0 allowed)"
msgstr ""
#: legacy.lua
msgid "Legacy file loaded."
msgstr ""
#: legacy.lua
msgid "unnamed"
msgstr ""
#: legacy.lua
msgid "Table format updated."
msgstr ""
#: legacy.lua
msgid "Converted areas saved. Done."
msgstr ""
#: pos.lua
msgid "Select a area by id."
msgstr ""
#: pos.lua
msgid "Invalid usage, see /help select_area."
msgstr ""
#: pos.lua
msgid "The area @1 does not exist."
msgstr ""
#: pos.lua
msgid "Area @1 selected."
msgstr ""
#: pos.lua
msgid ""
"Set area protection region position 1 to your location or the one specified"
msgstr ""
#: pos.lua
msgid "Unable to get position."
msgstr ""
#: pos.lua
msgid "Invalid usage, see /help area_pos1."
msgstr ""
#: pos.lua
msgid "Area position 1 set to "
msgstr ""
#: pos.lua
msgid ""
"Set area protection region position 2 to your location or the one specified"
msgstr ""
#: pos.lua
msgid "Invalid usage, see /help area_pos2."
msgstr ""
#: pos.lua
msgid "Area position 2 set to "
msgstr ""
#: pos.lua
msgid ""
"Set area protection region, position 1, or position 2 by punching nodes, or "
"display the region"
msgstr ""
#: pos.lua
msgid "Select positions by punching two nodes."
msgstr ""
#: pos.lua
msgid "Select position 1 by punching a node."
msgstr ""
#: pos.lua
msgid "Select position 2 by punching a node."
msgstr ""
#: pos.lua
msgid "<not set>"
msgstr ""
#: pos.lua
msgid "Unknown subcommand: "
msgstr ""
#: pos.lua
msgid "Position 1 set to "
msgstr ""
#: pos.lua
msgid "Position 2 set to "
msgstr ""
#: settings.lua
msgid "Invalid setting type!"
msgstr ""

53
pos.lua
View File

@ -1,10 +1,11 @@
-- I could depend on WorldEdit for this, but you need to have the 'worldedit' -- I could depend on WorldEdit for this, but you need to have the 'worldedit'
-- permission to use those commands and you don't have -- permission to use those commands and you don't have
-- /area_pos{1,2} [X Y Z|X,Y,Z]. -- /area_pos{1,2} [X Y Z|X,Y,Z].
-- Since this is mostly copied from WorldEdit it is mostly -- Since this is mostly copied from WorldEdit it is mostly
-- licensed under the AGPL. (select_area is a exception) -- licensed under the AGPL. (select_area is a exception)
local S = areas.intllib
areas.marker1 = {} areas.marker1 = {}
areas.marker2 = {} areas.marker2 = {}
areas.set_pos = {} areas.set_pos = {}
@ -13,26 +14,26 @@ areas.pos2 = {}
minetest.register_chatcommand("select_area", { minetest.register_chatcommand("select_area", {
params = "<ID>", params = "<ID>",
description = "Select a area by id.", description = S("Select a area by id."),
func = function(name, param) func = function(name, param)
local id = tonumber(param) local id = tonumber(param)
if not id then if not id then
return false, "Invalid usage, see /help select_area." return false, S("Invalid usage, see /help select_area.")
end end
if not areas.areas[id] then if not areas.areas[id] then
return false, "The area "..id.." does not exist." return false, S("The area @1 does not exist.", id)
end end
areas:setPos1(name, areas.areas[id].pos1) areas:setPos1(name, areas.areas[id].pos1)
areas:setPos2(name, areas.areas[id].pos2) areas:setPos2(name, areas.areas[id].pos2)
return true, "Area "..id.." selected." return true, S("Area @1 selected.", id)
end, end,
}) })
minetest.register_chatcommand("area_pos1", { minetest.register_chatcommand("area_pos1", {
params = "[X Y Z|X,Y,Z]", params = "[X Y Z|X,Y,Z]",
description = "Set area protection region position 1 to your" description = S("Set area protection region position 1 to your"
.." location or the one specified", .." location or the one specified"),
privs = {}, privs = {},
func = function(name, param) func = function(name, param)
local pos = nil local pos = nil
@ -45,22 +46,22 @@ minetest.register_chatcommand("area_pos1", {
if player then if player then
pos = player:getpos() pos = player:getpos()
else else
return false, "Unable to get position." return false, S("Unable to get position.")
end end
else else
return false, "Invalid usage, see /help area_pos1." return false, S("Invalid usage, see /help area_pos1.")
end end
pos = vector.round(pos) pos = vector.round(pos)
areas:setPos1(name, pos) areas:setPos1(name, pos)
return true, "Area position 1 set to " return true, S("Area position 1 set to ")
..minetest.pos_to_string(pos) ..minetest.pos_to_string(pos)
end, end,
}) })
minetest.register_chatcommand("area_pos2", { minetest.register_chatcommand("area_pos2", {
params = "[X Y Z|X,Y,Z]", params = "[X Y Z|X,Y,Z]",
description = "Set area protection region position 2 to your" description = S("Set area protection region position 2 to your"
.." location or the one specified", .." location or the one specified"),
func = function(name, param) func = function(name, param)
local pos = nil local pos = nil
local found, _, x, y, z = param:find( local found, _, x, y, z = param:find(
@ -72,14 +73,14 @@ minetest.register_chatcommand("area_pos2", {
if player then if player then
pos = player:getpos() pos = player:getpos()
else else
return false, "Unable to get position." return false, S("Unable to get position.")
end end
else else
return false, "Invalid usage, see /help area_pos2." return false, S("Invalid usage, see /help area_pos2.")
end end
pos = vector.round(pos) pos = vector.round(pos)
areas:setPos2(name, pos) areas:setPos2(name, pos)
return true, "Area position 2 set to " return true, S("Area position 2 set to ")
..minetest.pos_to_string(pos) ..minetest.pos_to_string(pos)
end, end,
}) })
@ -87,33 +88,33 @@ minetest.register_chatcommand("area_pos2", {
minetest.register_chatcommand("area_pos", { minetest.register_chatcommand("area_pos", {
params = "set/set1/set2/get", params = "set/set1/set2/get",
description = "Set area protection region, position 1, or position 2" description = S("Set area protection region, position 1, or position 2"
.." by punching nodes, or display the region", .." by punching nodes, or display the region"),
func = function(name, param) func = function(name, param)
if param == "set" then -- Set both area positions if param == "set" then -- Set both area positions
areas.set_pos[name] = "pos1" areas.set_pos[name] = "pos1"
return true, "Select positions by punching two nodes." return true, S("Select positions by punching two nodes.")
elseif param == "set1" then -- Set area position 1 elseif param == "set1" then -- Set area position 1
areas.set_pos[name] = "pos1only" areas.set_pos[name] = "pos1only"
return true, "Select position 1 by punching a node." return true, S("Select position 1 by punching a node.")
elseif param == "set2" then -- Set area position 2 elseif param == "set2" then -- Set area position 2
areas.set_pos[name] = "pos2" areas.set_pos[name] = "pos2"
return true, "Select position 2 by punching a node." return true, S("Select position 2 by punching a node.")
elseif param == "get" then -- Display current area positions elseif param == "get" then -- Display current area positions
local pos1str, pos2str = "Position 1: ", "Position 2: " local pos1str, pos2str = "Position 1: ", "Position 2: "
if areas.pos1[name] then if areas.pos1[name] then
pos1str = pos1str..minetest.pos_to_string(areas.pos1[name]) pos1str = pos1str..minetest.pos_to_string(areas.pos1[name])
else else
pos1str = pos1str.."<not set>" pos1str = pos1str..S("<not set>")
end end
if areas.pos2[name] then if areas.pos2[name] then
pos2str = pos2str..minetest.pos_to_string(areas.pos2[name]) pos2str = pos2str..minetest.pos_to_string(areas.pos2[name])
else else
pos2str = pos2str.."<not set>" pos2str = pos2str..S("<not set>")
end end
return true, pos1str.."\n"..pos2str return true, pos1str.."\n"..pos2str
else else
return false, "Unknown subcommand: "..param return false, S("Unknown subcommand: ")..param
end end
end, end,
}) })
@ -149,21 +150,21 @@ minetest.register_on_punchnode(function(pos, node, puncher)
areas.markPos1(name) areas.markPos1(name)
areas.set_pos[name] = "pos2" areas.set_pos[name] = "pos2"
minetest.chat_send_player(name, minetest.chat_send_player(name,
"Position 1 set to " S("Position 1 set to ")
..minetest.pos_to_string(pos)) ..minetest.pos_to_string(pos))
elseif areas.set_pos[name] == "pos1only" then elseif areas.set_pos[name] == "pos1only" then
areas.pos1[name] = pos areas.pos1[name] = pos
areas.markPos1(name) areas.markPos1(name)
areas.set_pos[name] = nil areas.set_pos[name] = nil
minetest.chat_send_player(name, minetest.chat_send_player(name,
"Position 1 set to " S("Position 1 set to ")
..minetest.pos_to_string(pos)) ..minetest.pos_to_string(pos))
elseif areas.set_pos[name] == "pos2" then elseif areas.set_pos[name] == "pos2" then
areas.pos2[name] = pos areas.pos2[name] = pos
areas.markPos2(name) areas.markPos2(name)
areas.set_pos[name] = nil areas.set_pos[name] = nil
minetest.chat_send_player(name, minetest.chat_send_player(name,
"Position 2 set to " S("Position 2 set to ")
..minetest.pos_to_string(pos)) ..minetest.pos_to_string(pos))
end end
end end

View File

@ -1,4 +1,5 @@
local world_path = minetest.get_worldpath() local world_path = minetest.get_worldpath()
local S = areas.intllib
areas.config = {} areas.config = {}
@ -14,7 +15,7 @@ local function setting(tp, name, default)
elseif tp == "number" then elseif tp == "number" then
value = tonumber(minetest.settings:get(full_name)) value = tonumber(minetest.settings:get(full_name))
else else
error("Invalid setting type!") error(S("Invalid setting type!"))
end end
if value == nil then if value == nil then
value = default value = default