Добавить русификацию
This commit is contained in:
parent
869cbb0d61
commit
cdb823bd25
25
init.lua
Normal file → Executable file
25
init.lua
Normal file → Executable file
@ -25,6 +25,8 @@
|
||||
|
||||
]]--
|
||||
|
||||
local S = minetest.get_translator("filter")
|
||||
|
||||
filter = { registered_on_violations = {} }
|
||||
local words = {}
|
||||
local muted = {}
|
||||
@ -78,7 +80,7 @@ function filter.mute(name, duration)
|
||||
minetest.set_player_privs(name, privs)
|
||||
end
|
||||
|
||||
minetest.chat_send_player(name, "Watch your language! You have been temporarily muted")
|
||||
minetest.chat_send_player(name, S("Watch your language! You have been temporarily muted"))
|
||||
|
||||
muted[name] = true
|
||||
|
||||
@ -89,7 +91,7 @@ function filter.mute(name, duration)
|
||||
end
|
||||
|
||||
muted[name] = nil
|
||||
minetest.chat_send_player(name, "Chat privilege reinstated. Please do not abuse chat.")
|
||||
minetest.chat_send_player(name, S("Chat privilege reinstated. Please do not abuse chat."))
|
||||
|
||||
privs.shout = true
|
||||
minetest.set_player_privs(name, privs)
|
||||
@ -99,8 +101,7 @@ end
|
||||
function filter.show_warning_formspec(name)
|
||||
local formspec = "size[7,3]bgcolor[#080808BB;true]" .. [[
|
||||
image[0,0;2,2;filter_warning.png]
|
||||
label[2.3,0.5;Please watch your language!]
|
||||
]]
|
||||
label[2.3,0.5;]] .. S("Please watch your language!") .. "]"
|
||||
|
||||
if minetest.global_exists("rules") and rules.show then
|
||||
formspec = formspec .. [[
|
||||
@ -135,7 +136,7 @@ function filter.on_violation(name, message)
|
||||
filter.mute(name, 1)
|
||||
else
|
||||
resolution = "kicked"
|
||||
minetest.kick_player(name, "Please mind your language!")
|
||||
minetest.kick_player(name, S("Please mind your language!"))
|
||||
end
|
||||
end
|
||||
|
||||
@ -155,7 +156,7 @@ table.insert(minetest.registered_on_chat_messages, 1, function(name, message)
|
||||
|
||||
local privs = minetest.get_player_privs(name)
|
||||
if not privs.shout and muted[name] then
|
||||
minetest.chat_send_player(name, "You are temporarily muted.")
|
||||
minetest.chat_send_player(name, S("You are temporarily muted."))
|
||||
return true
|
||||
end
|
||||
|
||||
@ -204,28 +205,28 @@ end
|
||||
minetest.after(10*60, step)
|
||||
|
||||
minetest.register_chatcommand("filter", {
|
||||
params = "filter server",
|
||||
description = "manage swear word filter",
|
||||
params = S("filter server"),
|
||||
description = S("manage swear word filter"),
|
||||
privs = {server = true},
|
||||
func = function(name, param)
|
||||
local cmd, val = param:match("(%w+) (.+)")
|
||||
if param == "list" then
|
||||
return true, #words .. " words: " .. table.concat(words, ", ")
|
||||
return true, #words .. S(" words: ") .. table.concat(words, ", ")
|
||||
elseif cmd == "add" then
|
||||
table.insert(words, val)
|
||||
s:set_string("words", minetest.write_json(words))
|
||||
return true, "Added \"" .. val .. "\"."
|
||||
return true, S("Added \"") .. val .. "\"."
|
||||
elseif cmd == "remove" then
|
||||
for i, w in ipairs(words) do
|
||||
if w == val then
|
||||
table.remove(words, i)
|
||||
s:set_string("words", minetest.write_json(words))
|
||||
return true, "Removed \"" .. val .. "\"."
|
||||
return true, S("Removed \"") .. val .. "\"."
|
||||
end
|
||||
end
|
||||
return true, "\"" .. val .. "\" not found in list."
|
||||
else
|
||||
return true, "I know " .. #words .. " words.\nUsage: /filter <add|remove|list> [<word>]"
|
||||
return true, S("I know ") .. #words .. S(" words.\nUsage: /filter <add|remove|list> [<word>]")
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
13
locale/filter.ru.tr
Executable file
13
locale/filter.ru.tr
Executable file
@ -0,0 +1,13 @@
|
||||
# textdomain: filter
|
||||
|
||||
Watch your language! You have been temporarily muted=Следи за языком! Ваш звук временно отключен
|
||||
Chat privilege reinstated. Please do not abuse chat.=Привилегии чата восстановлены. Пожалуйста, не злоупотребляйте чатом.
|
||||
Please watch your language!=Пожалуйста, следите за своим языком!
|
||||
Please mind your language!=Пожалуйста, следите за своим языком!
|
||||
You are temporarily muted.=Ваш звук временно отключен.
|
||||
manage swear word filter=управлять фильтром нецензурных слов
|
||||
words= слова
|
||||
Added @n=Добавлен @n
|
||||
Removed @n=Удален @n
|
||||
I know =Я знаю
|
||||
words.@nUsage: /filter <add|remove|list> [<word>]= слова.@nИспользование: /filter <add|remove|list> [<list>]
|
Loading…
Reference in New Issue
Block a user