mirror of
https://github.com/minetest-mods/areas.git
synced 2024-11-18 08:20:24 +01:00
localisation
This commit is contained in:
parent
599d9350bb
commit
52011bdfa4
@ -1,3 +1,5 @@
|
||||
local MP = minetest.get_modpath(minetest.get_current_modname())
|
||||
local S, NS = dofile(MP.."/intllib.lua")
|
||||
|
||||
local old_is_protected = minetest.is_protected
|
||||
function minetest.is_protected(pos, name)
|
||||
@ -12,10 +14,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 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.after(1,anti_lag,{player=player,playerpos=playerpos})
|
||||
end
|
||||
end)
|
||||
|
45
intllib.lua
Normal file
45
intllib.lua
Normal file
@ -0,0 +1,45 @@
|
||||
|
||||
-- Fallback functions for when `intllib` is not installed.
|
||||
-- Code released under Unlicense <http://unlicense.org>.
|
||||
|
||||
-- Get the latest version of this file at:
|
||||
-- https://raw.githubusercontent.com/minetest-mods/intllib/master/lib/intllib.lua
|
||||
|
||||
local function format(str, ...)
|
||||
local args = { ... }
|
||||
local function repl(escape, open, num, close)
|
||||
if escape == "" then
|
||||
local replacement = tostring(args[tonumber(num)])
|
||||
if open == "" then
|
||||
replacement = replacement..close
|
||||
end
|
||||
return replacement
|
||||
else
|
||||
return "@"..open..num..close
|
||||
end
|
||||
end
|
||||
return (str:gsub("(@?)@(%(?)(%d+)(%)?)", repl))
|
||||
end
|
||||
|
||||
local gettext, ngettext
|
||||
if minetest.get_modpath("intllib") then
|
||||
if intllib.make_gettext_pair then
|
||||
-- New method using gettext.
|
||||
gettext, ngettext = intllib.make_gettext_pair()
|
||||
else
|
||||
-- Old method using text files.
|
||||
gettext = intllib.Getter()
|
||||
end
|
||||
end
|
||||
|
||||
-- Fill in missing functions.
|
||||
|
||||
gettext = gettext or function(msgid, ...)
|
||||
return format(msgid, ...)
|
||||
end
|
||||
|
||||
ngettext = ngettext or function(msgid, msgid_plural, n, ...)
|
||||
return format(n==1 and msgid or msgid_plural, ...)
|
||||
end
|
||||
|
||||
return gettext, ngettext
|
23
locale/fr.po
Normal file
23
locale/fr.po
Normal file
@ -0,0 +1,23 @@
|
||||
# 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.
|
||||
#
|
||||
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"
|
||||
"Language-Team: \n"
|
||||
"Language: fr\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"X-Generator: Poedit 1.8.12\n"
|
||||
"Plural-Forms: nplurals=2; plural=(n > 1);\n"
|
||||
|
||||
#: init.lua
|
||||
msgid "@1 is protected by @2"
|
||||
msgstr "@1 est protégé par @2"
|
Loading…
Reference in New Issue
Block a user