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

View File

@ -4,6 +4,11 @@
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.startTime = os.clock()
@ -20,20 +25,20 @@ dofile(areas.modpath.."/hud.lua")
areas:load()
minetest.register_privilege("areas", {
description = "Can administer areas."
description = S("Can administer areas.")
})
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
minetest.register_privilege(areas.config.self_protection_privilege, {
description = "Can protect areas.",
description = S("Can protect areas."),
})
end
if minetest.settings:get_bool("log_mod") then
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

View File

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

View File

@ -1,5 +1,7 @@
local S = areas.intllib
-- 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)
return minetest.get_auth_handler().get_auth(name) ~= nil
@ -21,7 +23,7 @@ end
function areas:save()
local datastr = minetest.serialize(self.areas)
if not datastr then
minetest.log("error", "[areas] Failed to serialize area data!")
minetest.log("error", S("[areas] Failed to serialize area data!"))
return
end
return safe_file_write(self.config.filename, datastr)
@ -48,8 +50,8 @@ end
-- @return Whether the ID was valid.
function areas:checkAreaStoreId(sid)
if not sid then
minetest.log("error", "AreaStore failed to find an ID for an "
.."area! Falling back to iterative area checking.")
minetest.log("error", S("AreaStore failed to find an ID for an "
.."area! Falling back to iterative area checking."))
self.store = nil
self.store_ids = nil
end
@ -200,8 +202,8 @@ function areas:canPlayerAddArea(pos1, pos2, name)
-- and if the area is too big.
if not self.config.self_protection or
not privs[areas.config.self_protection_privilege] then
return false, "Self protection is disabled or you do not have"
.." the necessary privilege."
return false, S("Self protection is disabled or you do not have"
.." the necessary privilege.")
end
-- 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.y - pos1.y) > max_size.y or
(pos2.z - pos1.z) > max_size.z then
return false, "Area is too big."
return false, S("Area is too big.")
end
-- 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
if count >= max_areas then
return false, "You have reached the maximum amount of"
.." areas that you are allowed to protect."
return false, S("You have reached the maximum amount of"
.." areas that you are allowed to protect.")
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
if not can then
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)
end

View File

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

View File

@ -7,9 +7,9 @@ msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2018-01-29 11:28+0200\n"
"PO-Revision-Date: 2018-01-29 09:18+0200\n"
"Last-Translator: \n"
"POT-Creation-Date: 2017-08-02 14:48+0200\n"
"PO-Revision-Date: 2017-08-02 15:35+0200\n"
"Last-Translator: fat115 <fat115@framasoft.org>\n"
"Language-Team: \n"
"Language: fr\n"
"MIME-Version: 1.0\n"
@ -18,6 +18,503 @@ msgstr ""
"X-Generator: Poedit 1.8.12\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
msgid "@1 is protected by @2"
msgstr "@1 est protégé par @2"
msgid "Can administer areas."
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'
-- permission to use those commands and you don't have
-- /area_pos{1,2} [X Y Z|X,Y,Z].
-- Since this is mostly copied from WorldEdit it is mostly
-- licensed under the AGPL. (select_area is a exception)
local S = areas.intllib
areas.marker1 = {}
areas.marker2 = {}
areas.set_pos = {}
@ -13,26 +14,26 @@ areas.pos2 = {}
minetest.register_chatcommand("select_area", {
params = "<ID>",
description = "Select a area by id.",
description = S("Select a area by id."),
func = function(name, param)
local id = tonumber(param)
if not id then
return false, "Invalid usage, see /help select_area."
return false, S("Invalid usage, see /help select_area.")
end
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
areas:setPos1(name, areas.areas[id].pos1)
areas:setPos2(name, areas.areas[id].pos2)
return true, "Area "..id.." selected."
return true, S("Area @1 selected.", id)
end,
})
minetest.register_chatcommand("area_pos1", {
params = "[X Y Z|X,Y,Z]",
description = "Set area protection region position 1 to your"
.." location or the one specified",
description = S("Set area protection region position 1 to your"
.." location or the one specified"),
privs = {},
func = function(name, param)
local pos = nil
@ -45,22 +46,22 @@ minetest.register_chatcommand("area_pos1", {
if player then
pos = player:getpos()
else
return false, "Unable to get position."
return false, S("Unable to get position.")
end
else
return false, "Invalid usage, see /help area_pos1."
return false, S("Invalid usage, see /help area_pos1.")
end
pos = vector.round(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)
end,
})
minetest.register_chatcommand("area_pos2", {
params = "[X Y Z|X,Y,Z]",
description = "Set area protection region position 2 to your"
.." location or the one specified",
description = S("Set area protection region position 2 to your"
.." location or the one specified"),
func = function(name, param)
local pos = nil
local found, _, x, y, z = param:find(
@ -72,14 +73,14 @@ minetest.register_chatcommand("area_pos2", {
if player then
pos = player:getpos()
else
return false, "Unable to get position."
return false, S("Unable to get position.")
end
else
return false, "Invalid usage, see /help area_pos2."
return false, S("Invalid usage, see /help area_pos2.")
end
pos = vector.round(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)
end,
})
@ -87,33 +88,33 @@ minetest.register_chatcommand("area_pos2", {
minetest.register_chatcommand("area_pos", {
params = "set/set1/set2/get",
description = "Set area protection region, position 1, or position 2"
.." by punching nodes, or display the region",
description = S("Set area protection region, position 1, or position 2"
.." by punching nodes, or display the region"),
func = function(name, param)
if param == "set" then -- Set both area positions
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
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
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
local pos1str, pos2str = "Position 1: ", "Position 2: "
if areas.pos1[name] then
pos1str = pos1str..minetest.pos_to_string(areas.pos1[name])
else
pos1str = pos1str.."<not set>"
pos1str = pos1str..S("<not set>")
end
if areas.pos2[name] then
pos2str = pos2str..minetest.pos_to_string(areas.pos2[name])
else
pos2str = pos2str.."<not set>"
pos2str = pos2str..S("<not set>")
end
return true, pos1str.."\n"..pos2str
else
return false, "Unknown subcommand: "..param
return false, S("Unknown subcommand: ")..param
end
end,
})
@ -149,21 +150,21 @@ minetest.register_on_punchnode(function(pos, node, puncher)
areas.markPos1(name)
areas.set_pos[name] = "pos2"
minetest.chat_send_player(name,
"Position 1 set to "
S("Position 1 set to ")
..minetest.pos_to_string(pos))
elseif areas.set_pos[name] == "pos1only" then
areas.pos1[name] = pos
areas.markPos1(name)
areas.set_pos[name] = nil
minetest.chat_send_player(name,
"Position 1 set to "
S("Position 1 set to ")
..minetest.pos_to_string(pos))
elseif areas.set_pos[name] == "pos2" then
areas.pos2[name] = pos
areas.markPos2(name)
areas.set_pos[name] = nil
minetest.chat_send_player(name,
"Position 2 set to "
S("Position 2 set to ")
..minetest.pos_to_string(pos))
end
end

View File

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