Add initial localization

master
MoNTE48 2020-03-16 02:08:31 +01:00
parent 25325f579c
commit b6c2a97bdb
3 changed files with 16 additions and 5 deletions

View File

@ -1,3 +1,5 @@
local S = intllib.make_gettext_pair()
local old_is_protected = minetest.is_protected
local disallowed = {
@ -42,7 +44,7 @@ minetest.register_on_protection_violation(function(pos, name)
if not areas:canInteract(pos, name) then
local owners = areas:getNodeOwners(pos)
minetest.chat_send_player(name,
("%s is protected by %s."):format(
(S("%s is protected by %s.")):format(
minetest.pos_to_string(pos),
table.concat(owners, ", ")))

7
locale/ru.txt Normal file
View File

@ -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

View File

@ -1,3 +1,5 @@
local S = intllib.make_gettext_pair()
local radius = minetest.settings:get("areasprotector_radius") or 8
local function cyan(str)
@ -9,7 +11,7 @@ local function red(str)
end
minetest.register_node("areas:protector", {
description = "Protector Block",
description = S("Protector Block"),
groups = {cracky = 1},
tiles = {
"default_stonebrick_carved.png",
@ -32,17 +34,17 @@ minetest.register_node("areas:protector", {
if not minetest.is_protected_action(pos, name) then
local perm, err = areas:canPlayerAddArea(pos1, pos2, name)
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
end
local id = areas:add(name, "Protector Block", pos1, pos2)
areas:save()
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)))
minetest.set_node(pos, {name = "areas:protector"})
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_string("owner", name)
itemstack:take_item()