Skip to content

Commit

Permalink
Локализация новых выводов в чат (частично)
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexell committed Jan 31, 2022
1 parent 59815bc commit 320b9be
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 25 deletions.
54 changes: 29 additions & 25 deletions lua/autorun/metrostroi_advanced_init.lua
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
return
------------------------ Metrostroi Advanced -------------------------
-- Developers:
-- Alexell | https://steamcommunity.com/profiles/76561198210303223
Expand Down Expand Up @@ -47,6 +48,9 @@ function MetrostroiAdvanced.LoadLanguage(lang)
end

if SERVER then
local function lang(str)
return MetrostroiAdvanced.Lang[str]
end
-- Список слов из точек телепорта для игнорирования запрета спавна на станциях
function MetrostroiAdvanced.LoadStationsIgnore()
if not file.Exists("metrostroi_advanced/stations_ignore.txt","DATA") then
Expand Down Expand Up @@ -241,7 +245,7 @@ if SERVER then
else
ent_station = "N/A"
end
if (ent_station=="") then ent_station = MetrostroiAdvanced.Lang["UnknownPlace"] end
if (ent_station=="") then ent_station = lang("UnknownPlace") end
return ent_station
end

Expand Down Expand Up @@ -415,16 +419,16 @@ if SERVER then
end
if route_found and route_opened then
timer.Simple(0.2, function()
ulx.fancyLog("#s opened emergency route #s.", ply:Nick(), Name:upper())
ulx.fancyLog("#s "..lang("OpenedEmerRoute").." #s.", ply:Nick(), Name:upper())
end)
elseif route_found and not route_opened then
timer.Simple(0.2, function()
ply:ChatPrint("Emergency route "..Name:upper().." is already opened.")
ply:ChatPrint(lang("EmerRoute").." "..Name:upper().." "..lang("AlreadyOpened")..".")
end)
end
if not route_found then
timer.Simple(0.2, function()
ply:ChatPrint("Emergency route "..Name:upper().." not found.")
ply:ChatPrint(lang("EmerRoute").." "..Name:upper().." "..lang("NotFound")..".")
end)
end
elseif comm == "!sdeactiv" then
Expand All @@ -444,16 +448,16 @@ if SERVER then
end
if route_found and route_closed then
timer.Simple(0.2, function()
ulx.fancyLog("#s closed emergency route #s.", ply:Nick(), Name:upper())
ulx.fancyLog("#s "..lang("ClosedEmerRoute").." #s.", ply:Nick(), Name:upper())
end)
elseif route_found and not route_closed then
timer.Simple(0.2, function()
ply:ChatPrint("Emergency route "..Name:upper().." is already closed.")
ply:ChatPrint(lang("EmerRoute").." "..Name:upper().." "..lang("AlreadyClosed")..".")
end)
end
if not route_found then
timer.Simple(0.2, function()
ply:ChatPrint("Emergency route "..Name:upper().." not found.")
ply:ChatPrint(lang("EmerRoute").." "..Name:upper().." "..lang("NotFound")..".")
end)
end
elseif comm == "!sclose" then
Expand Down Expand Up @@ -500,25 +504,25 @@ if SERVER then
end
if signal_found and signal_closed then
timer.Simple(0.2, function()
ulx.fancyLog("#s closed signal #s.", ply:Nick(), Name:upper())
ulx.fancyLog("#s "..lang("ClosedSignal").." #s.", ply:Nick(), Name:upper())
end)
elseif signal_found and not signal_closed then
timer.Simple(0.2, function()
ply:ChatPrint("Signal "..Name:upper().." is already closed.")
ply:ChatPrint(lang("Signal").." "..Name:upper()..lang("AlreadyClosed")..".")
end)
end
if route_found and route_closed then
timer.Simple(0.2, function()
ulx.fancyLog("#s closed route #s.", ply:Nick(), Name:upper())
ulx.fancyLog("#s "..lang("ClosedRoute").." #s.", ply:Nick(), Name:upper())
end)
elseif route_found and not route_closed then
timer.Simple(0.2, function()
ply:ChatPrint("Route "..Name:upper().." is already closed.")
ply:ChatPrint(lang("Route").." "..Name:upper()..lang("AlreadyClosed")..".")
end)
end
if not route_found and not signal_found then
timer.Simple(0.2, function()
ply:ChatPrint("Signal/Route "..Name:upper().." not found.")
ply:ChatPrint(lang("SignalOrRoute").." "..Name:upper()..lang("NotFound")..".")
end)
end
elseif comm == "!sopen" then
Expand Down Expand Up @@ -552,25 +556,25 @@ if SERVER then
end
if signal_found and signal_opened then
timer.Simple(0.2, function()
ulx.fancyLog("#s opened signal #s.", ply:Nick(), Name:upper())
ulx.fancyLog("#s "..lang("OpenedSignal").." #s.", ply:Nick(), Name:upper())
end)
elseif signal_found and not signal_opened then
timer.Simple(0.2, function()
ply:ChatPrint("Signal "..Name:upper().." is already opened.")
ply:ChatPrint(lang("Signal").." "..Name:upper().." "..lang("AlreadyOpened")..".")
end)
end
if route_found and route_opened then
timer.Simple(0.2, function()
ulx.fancyLog("#s opened route #s.", ply:Nick(), Name:upper())
ulx.fancyLog("#s "..lang("OpenedRoute").." #s.", ply:Nick(), Name:upper())
end)
elseif route_found and not route_opened then
timer.Simple(0.2, function()
ply:ChatPrint("Route "..Name:upper().." is already opened.")
ply:ChatPrint(lang("Route").." "..Name:upper().." "..lang("AlreadyOpened")..".")
end)
end
if not route_found and not signal_found then
timer.Simple(0.2, function()
ply:ChatPrint("Signal/Route "..Name:upper().." not found.")
ply:ChatPrint(lang("SignalOrRoute").." "..Name:upper()..lang("NotFound")..".")
end)
end
elseif comm == "!sopps" then
Expand All @@ -587,11 +591,11 @@ if SERVER then
end
if signal_found and signal_opened then
timer.Simple(0.2, function()
ulx.fancyLog("#s opened IS on signal #s.", ply:Nick(), Name:upper())
ulx.fancyLog("#s "..lang("OpenedIS").." #s.", ply:Nick(), Name:upper())
end)
elseif not signal_found then
timer.Simple(0.2, function()
ply:ChatPrint("Signal "..Name:upper().." not found.")
ply:ChatPrint(lang("Signal").." "..Name:upper()..lang("NotFound")..".")
end)
end
elseif comm == "!sclps" then
Expand All @@ -608,11 +612,11 @@ if SERVER then
end
if signal_found and signal_closed then
timer.Simple(0.2, function()
ulx.fancyLog("#s closed IS on signal #s.", ply:Nick(), Name:upper())
ulx.fancyLog("#s "..lang("ClosedIS").." #s.", ply:Nick(), Name:upper())
end)
elseif not signal_found then
timer.Simple(0.2, function()
ply:ChatPrint("Signal "..Name:upper().." not found.")
ply:ChatPrint(lang("Signal").." "..Name:upper()..lang("NotFound")..".")
end)
end
elseif Metrostroi.Version > 1537278077 then
Expand All @@ -627,11 +631,11 @@ if SERVER then
end
if signal_found and ao_changed then
timer.Simple(0.2, function()
ulx.fancyLog("#s enabled AO on signal #s.", ply:Nick(), Name:upper())
ulx.fancyLog("#s "..lang("EnabledAS").." #s.", ply:Nick(), Name:upper())
end)
elseif not signal_found then
timer.Simple(0.2, function()
ply:ChatPrint("Signal "..Name:upper().." not found.")
ply:ChatPrint(lang("Signal").." "..Name:upper()..lang("NotFound")..".")
end)
end
elseif comm == "!sdisao" then
Expand All @@ -645,11 +649,11 @@ if SERVER then
end
if signal_found and ao_changed then
timer.Simple(0.2, function()
ulx.fancyLog("#s disabled AO on signal #s.", ply:Nick(), Name:upper())
ulx.fancyLog("#s "..lang("DisabledAS").." #s.", ply:Nick(), Name:upper())
end)
elseif not signal_found then
timer.Simple(0.2, function()
ply:ChatPrint("Signal "..Name:upper().." not found.")
ply:ChatPrint(lang("Signal").." "..Name:upper()..lang("NotFound")..".")
end)
end
end
Expand Down
14 changes: 14 additions & 0 deletions lua/metrostroi_advanced/language/en.lua
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,20 @@ MetrostroiAdvanced.Lang["Afkmins"] = "minute(s)"
MetrostroiAdvanced.Lang["Afkmin1"] = "minute"
MetrostroiAdvanced.Lang["AfkKick"] = "kicked for being AFK"
MetrostroiAdvanced.Lang["PressedButton"] = "pressed button"
MetrostroiAdvanced.Lang["OpenedEmerRoute"] = "opened emergency route"
MetrostroiAdvanced.Lang["ClosedEmerRoute"] = "opened emergency route"
MetrostroiAdvanced.Lang["EmerRoute"] = "Emergency route"
MetrostroiAdvanced.Lang["AlreadyOpened"] = "is already opened"
MetrostroiAdvanced.Lang["AlreadyClosed"] = "is already closed"
MetrostroiAdvanced.Lang["SignalOrRoute"] = "Signal/Route"
MetrostroiAdvanced.Lang["ClosedSignal"] = "closed signal"
MetrostroiAdvanced.Lang["ClosedRoute"] = "closed route"
MetrostroiAdvanced.Lang["OpenedSignal"] = "opened signal"
MetrostroiAdvanced.Lang["OpenedRoute"] = "opened route"
MetrostroiAdvanced.Lang["OpenedIS"] = "opened IS on signal"
MetrostroiAdvanced.Lang["ClosedIS"] = "closed IS on signal"
MetrostroiAdvanced.Lang["EnabledAS"] = "enabled AS on signal"
MetrostroiAdvanced.Lang["DisabledAS"] = "disabled AO on signal"

-- ULX
MetrostroiAdvanced.Lang["Teleported"] = "teleported"
Expand Down
14 changes: 14 additions & 0 deletions lua/metrostroi_advanced/language/ru.lua
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,20 @@ MetrostroiAdvanced.Lang["Afkmins"] = "минут(ы)"
MetrostroiAdvanced.Lang["Afkmin1"] = "минуту"
MetrostroiAdvanced.Lang["AfkKick"] = "отключен за бездействие"
MetrostroiAdvanced.Lang["PressedButton"] = "нажал кнопку"
MetrostroiAdvanced.Lang["OpenedEmerRoute"] = "opened emergency route"
MetrostroiAdvanced.Lang["ClosedEmerRoute"] = "closed emergency route"
MetrostroiAdvanced.Lang["EmerRoute"] = "Emergency route"
MetrostroiAdvanced.Lang["AlreadyOpened"] = "уже открыт"
MetrostroiAdvanced.Lang["AlreadyClosed"] = "уже закрыт"
MetrostroiAdvanced.Lang["SignalOrRoute"] = "Светофор/Маршрут"
MetrostroiAdvanced.Lang["ClosedSignal"] = "закрыл светофор"
MetrostroiAdvanced.Lang["ClosedRoute"] = "закрыл маршрут"
MetrostroiAdvanced.Lang["OpenedSignal"] = "открыл светофор"
MetrostroiAdvanced.Lang["OpenedRoute"] = "открыл маршрут"
MetrostroiAdvanced.Lang["OpenedIS"] = "открыл ПС на светофоре"
MetrostroiAdvanced.Lang["ClosedIS"] = "закрыл ПС на светофоре"
MetrostroiAdvanced.Lang["EnabledAS"] = "включил АО на светофоре"
MetrostroiAdvanced.Lang["DisabledAS"] = "выключил АО на светофоре"

-- ULX
MetrostroiAdvanced.Lang["Teleported"] = "телепортировался"
Expand Down

0 comments on commit 320b9be

Please sign in to comment.