Add initial localization
parent
25325f579c
commit
b6c2a97bdb
|
@ -1,3 +1,5 @@
|
||||||
|
local S = intllib.make_gettext_pair()
|
||||||
|
|
||||||
local old_is_protected = minetest.is_protected
|
local old_is_protected = minetest.is_protected
|
||||||
|
|
||||||
local disallowed = {
|
local disallowed = {
|
||||||
|
@ -42,7 +44,7 @@ minetest.register_on_protection_violation(function(pos, name)
|
||||||
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,
|
minetest.chat_send_player(name,
|
||||||
("%s is protected by %s."):format(
|
(S("%s is protected by %s.")):format(
|
||||||
minetest.pos_to_string(pos),
|
minetest.pos_to_string(pos),
|
||||||
table.concat(owners, ", ")))
|
table.concat(owners, ", ")))
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,7 @@
|
||||||
|
%s is protected by %s.=%s защищено %s.
|
||||||
|
|
||||||
|
#Protector Block
|
||||||
|
Protector Block=Защитный Блок
|
||||||
|
You are not allowed to protect that area:=Вам не разрешено защищать эту область:
|
||||||
|
The area from %s to %s has been protected as #%s=Зона от %s до %s была защещена, #%s
|
||||||
|
Protecting area %d, Owned by %s=Защищённая зона %d, Владелец: %s
|
|
@ -1,3 +1,5 @@
|
||||||
|
local S = intllib.make_gettext_pair()
|
||||||
|
|
||||||
local radius = minetest.settings:get("areasprotector_radius") or 8
|
local radius = minetest.settings:get("areasprotector_radius") or 8
|
||||||
|
|
||||||
local function cyan(str)
|
local function cyan(str)
|
||||||
|
@ -9,7 +11,7 @@ local function red(str)
|
||||||
end
|
end
|
||||||
|
|
||||||
minetest.register_node("areas:protector", {
|
minetest.register_node("areas:protector", {
|
||||||
description = "Protector Block",
|
description = S("Protector Block"),
|
||||||
groups = {cracky = 1},
|
groups = {cracky = 1},
|
||||||
tiles = {
|
tiles = {
|
||||||
"default_stonebrick_carved.png",
|
"default_stonebrick_carved.png",
|
||||||
|
@ -32,17 +34,17 @@ minetest.register_node("areas:protector", {
|
||||||
if not minetest.is_protected_action(pos, name) then
|
if not minetest.is_protected_action(pos, name) then
|
||||||
local perm, err = areas:canPlayerAddArea(pos1, pos2, name)
|
local perm, err = areas:canPlayerAddArea(pos1, pos2, name)
|
||||||
if not perm then
|
if not perm then
|
||||||
minetest.chat_send_player(name, red("You are not allowed to protect that area: ") .. err)
|
minetest.chat_send_player(name, red(S("You are not allowed to protect that area:") .. " ") .. err)
|
||||||
return itemstack
|
return itemstack
|
||||||
end
|
end
|
||||||
local id = areas:add(name, "Protector Block", pos1, pos2)
|
local id = areas:add(name, "Protector Block", pos1, pos2)
|
||||||
areas:save()
|
areas:save()
|
||||||
minetest.chat_send_player(name,
|
minetest.chat_send_player(name,
|
||||||
("The area from %s to %s has been protected as #%s")
|
(S("The area from %s to %s has been protected as #%s"))
|
||||||
:format(cyan(minetest.pos_to_string(pos1)), cyan(minetest.pos_to_string(pos2)), cyan(id)))
|
:format(cyan(minetest.pos_to_string(pos1)), cyan(minetest.pos_to_string(pos2)), cyan(id)))
|
||||||
minetest.set_node(pos, {name = "areas:protector"})
|
minetest.set_node(pos, {name = "areas:protector"})
|
||||||
local meta = minetest.get_meta(pos)
|
local meta = minetest.get_meta(pos)
|
||||||
meta:set_string("infotext", ("Protecting area %d, Owned by %s"):format(id, name))
|
meta:set_string("infotext", (S("Protecting area %d, Owned by %s")):format(id, name))
|
||||||
meta:set_int("area_id", id)
|
meta:set_int("area_id", id)
|
||||||
meta:set_string("owner", name)
|
meta:set_string("owner", name)
|
||||||
itemstack:take_item()
|
itemstack:take_item()
|
||||||
|
|
Loading…
Reference in New Issue