Localization

This commit is contained in:
Kimapr 2019-12-20 23:36:26 +05:00
parent 1237381c60
commit 12d361e670
6 changed files with 84 additions and 24 deletions

View File

@ -4,6 +4,7 @@ local include, nodecore, minetest
-- LUALOCALS > ---------------------------------------------------------
local modname = minetest.get_current_modname()
local S = minetest.get_translator(modname)
ctf = {}
@ -44,13 +45,14 @@ function ctf.spawn(name,pos,call)
local n = math.random()
local pl = ctf.players[name]
if pl.transid then
minetest.chat_send_player("<TELEPORT> Cancelling previous transportation")
minetest.chat_send_player(S"<TELEPORT> Cancelling previous transportation")
end
pl.transid = n
pos = {x=f(pos.x),y=f(pos.y),z=f(pos.z)}
call = call or function()end
local limit = SPAWNFALL_LIMIT
minetest.chat_send_player(name,"<TELEPORT> Configuring transportation processor...")
minetest.chat_send_player(name,S"<TELEPORT> Configuring transportation processor...")
--minetest.after(30,function()
minetest.emerge_area({x=pos.x,y=pos.y-limit,z=pos.z},{x=pos.x,y=pos.y+limit,z=pos.z},function(bp,act,crem)
if crem > 0 then return end
pl = ctf.players[name]
@ -59,7 +61,7 @@ function ctf.spawn(name,pos,call)
return
end
pl.transid = nil
minetest.chat_send_player(name,"<TELEPORT> Done. Sending transport coordinates...")
minetest.chat_send_player(name,S"<TELEPORT> Done. Sending transport coordinates...")
local off = 0
while off > -limit do
if minetest.get_node({x=pos.x,y=pos.y+off,z=pos.z}).name ~= "air" then
@ -81,6 +83,7 @@ function ctf.spawn(name,pos,call)
call(ref,apos)
end
end)
--end)
end
end
@ -105,11 +108,11 @@ minetest.register_chatcommand("vote",{
desc = "Vote to do things",
func = function(name,param)
if ctf.ended then
minetest.chat_send_player(name,"<DEMOCRACY> Nothing to vote for")
minetest.chat_send_player(name,S"<DEMOCRACY> Nothing to vote for")
return
end
if not ctf.started and ctf.player_count < 2 then
minetest.chat_send_player(name,"<DEMOCRACY> Not enough players")
minetest.chat_send_player(name,S"<DEMOCRACY> Not enough players")
return
end
local pl = ctf.players[name]
@ -117,15 +120,15 @@ minetest.register_chatcommand("vote",{
ctf.voted_count = pl.voted and (ctf.voted_count+1) or (ctf.voted_count-1)
if ctf.started then
if pl.voted then
minetest.chat_send_player(name,"<DEMOCRACY> You vote to end the game")
minetest.chat_send_player(name,S"<DEMOCRACY> You vote to end the game")
else
minetest.chat_send_player(name,"<DEMOCRACY> You vote to NOT end the game")
minetest.chat_send_player(name,S"<DEMOCRACY> You vote to NOT end the game")
end
else
if pl.voted then
minetest.chat_send_player(name,"<DEMOCRACY> You vote to start the game")
minetest.chat_send_player(name,S"<DEMOCRACY> You vote to start the game")
else
minetest.chat_send_player(name,"<DEMOCRACY> You vote to NOT start the game")
minetest.chat_send_player(name,S"<DEMOCRACY> You vote to NOT start the game")
end
end
end
@ -204,7 +207,7 @@ function ctf.set_team_text(name)
assert(pl)
local team = teams[pl.team]
print(pl.team,team)
ctf.set_text(name,"You're member of "..tostring(team.desc).." team\n/vote to end the game",team.colornum)
ctf.set_text(name,S("You're member of @1 team",tostring(team.desc)).."\n"..S"/vote to end the game",team.colornum)
end
function ctf.join(team,name)
@ -236,7 +239,7 @@ minetest.register_on_joinplayer(function(ref)
local name = ref:get_player_name()
local id = ref:hud_add{
name = "stat",
text = "Game is not started yet\n/vote to start the game",
text = S"The game hasn't started yet".."\n"..S"/vote to end the game",
number = 0xFFFFFF,
alignment = {x=-1,y=1},
offset = {x=-20,y=20},
@ -317,7 +320,7 @@ end
function ctf.start()
if ctf.starting and (ctf.voted_count/ctf.player_count) < 0.5 then
minetest.chat_send_all("<INFO + DEMOCRACY> Aborting")
minetest.chat_send_all(S"<INFO + DEMOCRACY> Aborting")
ctf.starting = -math.huge
return
end
@ -325,7 +328,7 @@ function ctf.start()
local tc = math.max(2,math.floor(ctf.player_count/PLAYERS_PER_TEAM))
if ctf.player_count >= 2 and not ctf.starting and (ctf.voted_count/ctf.player_count) >= 0.5 then
ctf.starting = minetest.get_server_uptime()+10
minetest.chat_send_all("<INFO + DEMOCRACY> Most players are ready. Starting the game in 10...")
minetest.chat_send_all(S"<INFO + DEMOCRACY> Most players are ready. Starting the game in 10...")
do
local n = 10
local function f()
@ -333,7 +336,7 @@ function ctf.start()
local n2=math.ceil(ctf.starting-minetest.get_server_uptime())
if n2 ~= n and n2 > 0 then
n=n2
minetest.chat_send_all("<INFO> "..n.."...")
minetest.chat_send_all(S("<INFO> @1...",n))
end
if n2 > 0 then
minetest.after(0.2,f)
@ -343,11 +346,11 @@ function ctf.start()
end
elseif ctf.starting and not (ctf.player_count >= 2) then
ctf.starting = false
minetest.chat_send_all("<INFO> Not enough players now. Aborting.")
minetest.chat_send_all(S"<INFO> Not enough players now. Aborting.")
end
if ctf.starting and minetest.get_server_uptime() >= ctf.starting then
ctf.starting = math.huge
minetest.chat_send_all("<TELEPORT + INFO> CONFIGURING TRANSPORTATION PROCCESSORS FOR EVERYONE . . .")
minetest.chat_send_all(S"<TELEPORT + INFO> CONFIGURING TRANSPORTATION PROCCESSORS FOR EVERYONE . . .")
local c = 0
ctf.teams = {}
for k,v in pairs(teams) do
@ -370,11 +373,11 @@ function ctf.start()
pc = pc + 1
if pc < ctf.player_count then return end
if ctf.starting ~= math.huge then
minetest.chat_send_all("<TELEPORT + INFO> SOMETHING HAPPENED. ABORTING")
minetest.chat_send_all(S"<TELEPORT + INFO> SOMETHING HAPPENED. ABORTING")
ctf.teams = {}
for k,v in pairs(ctf.players) do
v.team = nil
ctf.set_text(k,"Game is not started yet\n/vote to start the game")
ctf.set_text(k,S"The game hasn't started yet".."\n"..S"/vote to end the game")
end
ctf.starting = false
ctf.started = false
@ -389,7 +392,7 @@ function ctf.start()
ctf.voted_count = ctf.voted_count - 1
end
end
minetest.chat_send_all("<INFO> The game begins!")
minetest.chat_send_all(S"<INFO> The game begins!")
for k,v in pairs(ctf.players) do
ctf.explode_inv(minetest.get_player_by_name(k))
end
@ -476,7 +479,7 @@ function ctf.check_win()
if team.score <= 0 then
ctf.teams[name] = nil
for pname,pl in pairs(team.players) do
ctf.set_text(pname,":(\nYour team lost.",teams[name].colornum)
ctf.set_text(pname,S":(".."\n"..S"Your team lost.",teams[name].colornum)
end
minetest.chat_send_all("<INFO> "..teams[name].desc.." team lost!")
end
@ -490,15 +493,15 @@ function ctf.check_win()
local name,team = next(ctf.teams)
minetest.chat_send_all("<INFO> "..teams[name].desc.." team won!")
for pname,pl in pairs(team.players) do
ctf.set_text(pname,":D\nYour team won!",teams[name].colornum)
ctf.set_text(pname,S":D".."\n"..S"Your team won!",teams[name].colornum)
end
elseif vout then
minetest.chat_send_all("<INFO> Majority of players voted to end the game")
minetest.chat_send_all(S"<INFO> Majority of players voted to end the game")
for k,v in pairs(ctf.players) do
ctf.set_text(k,"Game is not started yet\n/vote to start the game")
ctf.set_text(k,S"The game hasn't started yet".."\n"..S"/vote to end the game")
end
end
minetest.chat_send_all("<INFO> The game is finished")
minetest.chat_send_all(S"<INFO> The game is over")
ctf.teams = {}
do
local z = SPAWN_DIST

27
locale/nc_ctf.en.tr Normal file
View File

@ -0,0 +1,27 @@
# textdomain: nc_ctf
<TELEPORT> Cancelling previous transportation=<TELEPORT> Cancelling previous transportation
<TELEPORT> Configuring transportation processor...=<TELEPORT> Configuring transportation processor...
<TELEPORT> Done. Sending transport coordinates...=<TELEPORT> Done. Sending transport coordinates...
Vote to do things=Vote to do things
<DEMOCRACY> Nothing to vote for=<DEMOCRACY> Nothing to vote for
<DEMOCRACY> Not enough players=<DEMOCRACY> Not enough players
<DEMOCRACY> You vote to end the game=<DEMOCRACY> You vote to end the game
<DEMOCRACY> You vote to NOT end the game=<DEMOCRACY> You vote to NOT end the game
<DEMOCRACY> You vote to start the game=<DEMOCRACY> You vote to start the game
<DEMOCRACY> You vote to NOT start the game=<DEMOCRACY> You vote to NOT start the game
You're member of @1 team=You're member of @1 team
/vote to end the game=/vote to end the game
The game hasn't started yet=The game hasn't started yet
<INFO + DEMOCRACY> Aborting=<INFO + DEMOCRACY> Aborting
<INFO + DEMOCRACY> Most players are ready. Starting the game in 10...=<INFO + DEMOCRACY> Most players are ready. Starting the game in 10...
<INFO> @1...=<INFO> @1...
<INFO> Not enough players now. Aborting.=<INFO> Not enough players now. Aborting.
<TELEPORT + INFO> CONFIGURING TRANSPORTATION PROCCESSORS FOR EVERYONE . . .=<TELEPORT + INFO> CONFIGURING TRANSPORTATION PROCCESSORS FOR EVERYONE . . .
<TELEPORT + INFO> SOMETHING HAPPENED. ABORTING=<TELEPORT + INFO> SOMETHING HAPPENED. ABORTING
<INFO> The game begins!=<INFO> The game begins!
:(=:(
:D=:D
Your team lost.=Your team lost.
Your team won!=Your team won!
<INFO> Majority of players voted to end the game=<INFO> Majority of players voted to end the game
<INFO> The game is over=<INFO> The game is over

27
locale/nc_ctf.ru.tr Normal file
View File

@ -0,0 +1,27 @@
# textdomain: nc_ctf
<TELEPORT> Cancelling previous transportation=<TELEPORT> Отмена предыдущей телепортации
<TELEPORT> Configuring transportation processor...=<TELEPORT> Конфигурация транспортного процессора...
<TELEPORT> Done. Sending transport coordinates...=<TELEPORT> Готово. Отправка координат транспортации...
Vote to do things=Голосовать за всякие штуки
<DEMOCRACY> Nothing to vote for=<DEMOCRACY> Не за что голосовать
<DEMOCRACY> Not enough players=<DEMOCRACY> Недостаточно игроков
<DEMOCRACY> You vote to end the game=<DEMOCRACY> Вы голосуете за конец игры
<DEMOCRACY> You vote to NOT end the game=<DEMOCRACY> Вы голосуете против конца игры
<DEMOCRACY> You vote to start the game=<DEMOCRACY> Вы голосуете за начало игры
<DEMOCRACY> You vote to NOT start the game=<DEMOCRACY> Вы голосуете против начала игры
You're member of @1 team=Вы состоите в команде @1
/vote to end the game=/vote чтобы закончить игру
The game hasn't started yet=Игра еще не началась
<INFO + DEMOCRACY> Aborting=<INFO + DEMOCRACY> Отмена
<INFO + DEMOCRACY> Most players are ready. Starting the game in 10...=<INFO + DEMOCRACY> Многие игроки готовы. Начало игры через 10...
<INFO> @1...=<INFO> @1...
<INFO> Not enough players now. Aborting.=<INFO> Стало недостаточно игроков. Отмена.
<TELEPORT + INFO> CONFIGURING TRANSPORTATION PROCCESSORS FOR EVERYONE . . .=<TELEPORT + INFO> КОНФИГУРАЦИЯ ТРАНСПОРТНЫХ ПРОЦЕССОРОВ ДЛЯ ВСЕХ . . .
<TELEPORT + INFO> SOMETHING HAPPENED. ABORTING=<TELEPORT + INFO> ЧТО-ТО СЛУЧИЛОСЬ. ОТМЕНА
<INFO> The game begins!=<INFO> Игра начинается!
:(=:(
:D=:D
Your team lost.=Ваша команда проиграла.
Your team won!=Ваша команда выиграла!
<INFO> Majority of players voted to end the game=<INFO> Многие игроки проголосовали закончить эту игру
<INFO> The game is over=<INFO> Игра окончена

View File

@ -84,6 +84,7 @@ minetest.register_node(modname..":telebarrier",{
light_source = 14,
paramtype = "light",
drawtype="normal",
pointable = false,
tiles = {
{name = "nc_ctf_telebarrier.png",
animation={
@ -101,6 +102,7 @@ minetest.register_node(modname..":telebarrier",{
minetest.register_node(modname..":barrier_hole",{
drawtype="normal",
use_texture_alpha=true,
pointable = false,
tiles = {"nc_ctf_barrier_hole.png"},
})
@ -108,6 +110,7 @@ minetest.register_node(modname..":barrier",{
light_source = 14,
paramtype = "light",
drawtype="normal",
pointable = false,
tiles = {
{name = "nc_ctf_barrier.png",
animation={

Binary file not shown.

Binary file not shown.