Removed LocalizationManager dependencies (#2059)

* Removed LocalizationManager dependencies

* Fixed error

Co-authored-by: David Tan <>
This commit is contained in:
DTanxxx
2020-09-17 09:55:50 +12:00
committed by GitHub
parent 6b4fbc211f
commit 27a5a7a09c
19 changed files with 99 additions and 130 deletions

View File

@@ -16,22 +16,19 @@ namespace Content.Server.Administration
{
get
{
var localizationManager = IoCManager.Resolve<ILocalizationManager>();
return localizationManager.GetString("Deletes entities with the specified components.");
return Loc.GetString("Deletes entities with the specified components.");
}
}
public string Help
{
get
{
var localizationManager = IoCManager.Resolve<ILocalizationManager>();
return localizationManager.GetString("Usage: deleteewc <componentName_1> <componentName_2> ... <componentName_n>\nDeletes any entities with the components specified.");
return Loc.GetString("Usage: deleteewc <componentName_1> <componentName_2> ... <componentName_n>\nDeletes any entities with the components specified.");
}
}
public void Execute(IConsoleShell shell, IPlayerSession player, string[] args)
{
var localizationManager = IoCManager.Resolve<ILocalizationManager>();
if (args.Length < 1)
{
shell.SendText(player, Help);
@@ -55,7 +52,7 @@ namespace Content.Server.Administration
count += 1;
}
shell.SendText(player, localizationManager.GetString("Deleted {0} entities", count));
shell.SendText(player, Loc.GetString("Deleted {0} entities", count));
}
}
}

View File

@@ -15,28 +15,25 @@ namespace Content.Server.Administration
{
get
{
var localizationManager = IoCManager.Resolve<ILocalizationManager>();
return localizationManager.GetString("Fully heals a mob.");
return Loc.GetString("Fully heals a mob.");
}
}
public string Help
{
get
{
var localizationManager = IoCManager.Resolve<ILocalizationManager>();
return localizationManager.GetString("Usage: rejuvenate <mobUid_1> <mobUid_2> ... <mobUid_n>\nAttempts to heal the user's mob if no arguments are provided.");
return Loc.GetString("Usage: rejuvenate <mobUid_1> <mobUid_2> ... <mobUid_n>\nAttempts to heal the user's mob if no arguments are provided.");
}
}
public void Execute(IConsoleShell shell, IPlayerSession player, string[] args)
{
var localizationManager = IoCManager.Resolve<ILocalizationManager>();
if (args.Length < 1 && player != null) //Try to heal the users mob if applicable
{
shell.SendText(player, localizationManager.GetString("Healing the user's mob since no arguments were provided."));
shell.SendText(player, Loc.GetString("Healing the user's mob since no arguments were provided."));
if (player.AttachedEntity == null)
{
shell.SendText(player, localizationManager.GetString("There's no entity attached to the user."));
shell.SendText(player, Loc.GetString("There's no entity attached to the user."));
return;
}
RejuvenateVerb.PerformRejuvenate(player.AttachedEntity);
@@ -47,7 +44,7 @@ namespace Content.Server.Administration
{
if(!EntityUid.TryParse(arg, out var uid) || !entityManager.TryGetEntity(uid, out var entity))
{
shell.SendText(player, localizationManager.GetString("Could not find entity {0}", arg));
shell.SendText(player, Loc.GetString("Could not find entity {0}", arg));
continue;
}
RejuvenateVerb.PerformRejuvenate(entity);

View File

@@ -40,7 +40,6 @@ namespace Content.Server.Chat
[Dependency] private readonly IEntitySystemManager _entitySystemManager = default!;
[Dependency] private readonly IServerNetManager _netManager = default!;
[Dependency] private readonly IPlayerManager _playerManager = default!;
[Dependency] private readonly ILocalizationManager _localizationManager = default!;
[Dependency] private readonly IMoMMILink _mommiLink = default!;
[Dependency] private readonly IConGroupController _conGroupController = default!;
@@ -186,7 +185,7 @@ namespace Content.Server.Chat
var msg = _netManager.CreateNetMessage<MsgChatMessage>();
msg.Channel = ChatChannel.Dead;
msg.Message = message;
msg.MessageWrap = $"{_localizationManager.GetString("DEAD")}: {player.AttachedEntity.Name}: {{0}}";
msg.MessageWrap = $"{Loc.GetString("DEAD")}: {player.AttachedEntity.Name}: {{0}}";
msg.SenderEntity = player.AttachedEntityUid.GetValueOrDefault();
_netManager.ServerSendToMany(msg, clients.ToList());
}
@@ -211,7 +210,7 @@ namespace Content.Server.Chat
msg.Channel = ChatChannel.AdminChat;
msg.Message = message;
msg.MessageWrap = $"{_localizationManager.GetString("ADMIN")}: {player.SessionId}: {{0}}";
msg.MessageWrap = $"{Loc.GetString("ADMIN")}: {player.SessionId}: {{0}}";
_netManager.ServerSendToMany(msg, clients.ToList());
}

View File

@@ -960,7 +960,7 @@ namespace Content.Server.GameTicking
{
var gmTitle = MakeGamePreset(null).ModeTitle;
var desc = MakeGamePreset(null).Description;
return _localization.GetString(@"Hi and welcome to [color=white]Space Station 14![/color]
return Loc.GetString(@"Hi and welcome to [color=white]Space Station 14![/color]
The current game mode is: [color=white]{0}[/color].
[color=yellow]{1}[/color]", gmTitle, desc);
@@ -989,7 +989,6 @@ The current game mode is: [color=white]{0}[/color].
[Dependency] private IServerNetManager _netManager = default!;
[Dependency] private IDynamicTypeFactory _dynamicTypeFactory = default!;
[Dependency] private IPrototypeManager _prototypeManager = default!;
[Dependency] private readonly ILocalizationManager _localization = default!;
[Dependency] private readonly IRobustRandom _robustRandom = default!;
[Dependency] private readonly IServerPreferencesManager _prefsManager = default!;
[Dependency] private readonly IBaseServer _baseServer = default!;