Add translation support

This commit is contained in:
Louis Royer
2020-03-08 22:15:00 +01:00
committed by SmallJoker
parent aca830fd22
commit 4179917eb4
8 changed files with 324 additions and 169 deletions

View File

@ -1,3 +1,4 @@
local S = minetest.get_translator("areas")
function areas:player_exists(name)
return minetest.get_auth_handler().get_auth(name) ~= nil
@ -212,8 +213,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
local max_size = privs.areas_high_limit and
@ -223,7 +224,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
@ -237,16 +238,16 @@ 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
-- Check intersecting areas
local can, id = self:canInteractInArea(pos1, pos2, name)
if not can then
local area = self.areas[id]
return false, ("The area intersects with %s [%u] (%s).")
:format(area.name, id, area.owner)
return false, S("The area intersects with @1 [@2] (@3).",
area.name, id, area.owner)
end
return true