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

@@ -17,8 +17,6 @@ namespace Content.Client.Chat
public delegate void FilterToggledHandler(ChatBox chatBox, BaseButton.ButtonToggledEventArgs e);
private readonly ILocalizationManager _localize = IoCManager.Resolve<ILocalizationManager>();
public HistoryLineEdit Input { get; private set; }
public OutputPanel Contents { get; }
@@ -79,7 +77,7 @@ namespace Content.Client.Chat
AllButton = new Button
{
Text = _localize.GetString("All"),
Text = Loc.GetString("All"),
Name = "ALL",
SizeFlagsHorizontal = SizeFlags.ShrinkEnd | SizeFlags.Expand,
ToggleMode = true,
@@ -87,14 +85,14 @@ namespace Content.Client.Chat
LocalButton = new Button
{
Text = _localize.GetString("Local"),
Text = Loc.GetString("Local"),
Name = "Local",
ToggleMode = true,
};
OOCButton = new Button
{
Text = _localize.GetString("OOC"),
Text = Loc.GetString("OOC"),
Name = "OOC",
ToggleMode = true,
};
@@ -104,7 +102,7 @@ namespace Content.Client.Chat
{
AdminButton = new Button
{
Text = _localize.GetString("Admin"),
Text = Loc.GetString("Admin"),
Name = "Admin",
ToggleMode = true,
};

View File

@@ -12,8 +12,6 @@ namespace Content.Client.Command
{
public class CommunicationsConsoleMenu : SS14Window
{
[Dependency] private readonly ILocalizationManager _localizationManager = default!;
protected override Vector2? CustomSize => new Vector2(600, 400);
private CommunicationsConsoleBoundUserInterface Owner { get; set; }
@@ -25,7 +23,7 @@ namespace Content.Client.Command
{
IoCManager.InjectDependencies(this);
Title = _localizationManager.GetString("Communications Console");
Title = Loc.GetString("Communications Console");
Owner = owner;
_countdownLabel = new RichTextLabel(){CustomMinimumSize = new Vector2(0, 200)};
@@ -53,11 +51,11 @@ namespace Content.Client.Command
if (!Owner.CountdownStarted)
{
_countdownLabel.SetMessage("");
_emergencyShuttleButton.Text = _localizationManager.GetString("Call emergency shuttle");
_emergencyShuttleButton.Text = Loc.GetString("Call emergency shuttle");
return;
}
_emergencyShuttleButton.Text = _localizationManager.GetString("Recall emergency shuttle");
_emergencyShuttleButton.Text = Loc.GetString("Recall emergency shuttle");
_countdownLabel.SetMessage($"Time remaining\n{Owner.Countdown.ToString()}s");
}

View File

@@ -16,7 +16,6 @@ namespace Content.Client
[Dependency] private readonly IInputManager _inputManager = default!;
[Dependency] private readonly IStateManager _stateManager = default!;
[Dependency] private readonly IGameHud _gameHud = default!;
[Dependency] private readonly ILocalizationManager _localizationManager = default!;
private EscapeMenu _escapeMenu;
@@ -32,7 +31,7 @@ namespace Content.Client
if (obj.NewState is GameScreenBase)
{
// Switched TO GameScreen.
_escapeMenu = new EscapeMenu(_clientConsole, _localizationManager);
_escapeMenu = new EscapeMenu(_clientConsole);
_escapeMenu.OnClose += () => _gameHud.EscapeButtonDown = false;

View File

@@ -10,7 +10,6 @@ namespace Content.Client.GameObjects.Components.Access
{
public class IdCardConsoleBoundUserInterface : BoundUserInterface
{
[Dependency] private readonly ILocalizationManager _localizationManager = default!;
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
public IdCardConsoleBoundUserInterface(ClientUserInterfaceComponent owner, object uiKey) : base(owner, uiKey)
@@ -23,7 +22,7 @@ namespace Content.Client.GameObjects.Components.Access
{
base.Open();
_window = new IdCardConsoleWindow(this, _localizationManager, _prototypeManager);
_window = new IdCardConsoleWindow(this, _prototypeManager);
_window.Title = Owner.Owner.Name;
_window.OnClose += Close;
_window.OpenCentered();

View File

@@ -29,8 +29,6 @@ namespace Content.Client.GameObjects.Components.Access
private readonly IdCardConsoleBoundUserInterface _owner;
private readonly ILocalizationManager _loc;
private readonly Dictionary<string, Button> _accessButtons = new Dictionary<string, Button>();
private string _lastFullName;
@@ -38,9 +36,8 @@ namespace Content.Client.GameObjects.Components.Access
protected override Vector2? CustomSize => (650, 270);
public IdCardConsoleWindow(IdCardConsoleBoundUserInterface owner, ILocalizationManager loc, IPrototypeManager prototypeManager)
public IdCardConsoleWindow(IdCardConsoleBoundUserInterface owner, IPrototypeManager prototypeManager)
{
_loc = loc;
_owner = owner;
var vBox = new VBoxContainer();
@@ -49,11 +46,11 @@ namespace Content.Client.GameObjects.Components.Access
Columns = 3,
Children =
{
new Label {Text = loc.GetString("Privileged ID:")},
new Label {Text = Loc.GetString("Privileged ID:")},
(_privilegedIdButton = new Button()),
(_privilegedIdLabel = new Label()),
new Label {Text = loc.GetString("Target ID:")},
new Label {Text = Loc.GetString("Target ID:")},
(_targetIdButton = new Button()),
(_targetIdLabel = new Label())
}
@@ -75,7 +72,7 @@ namespace Content.Client.GameObjects.Components.Access
// Name
(_fullNameLabel = new Label
{
Text = loc.GetString("Full name:")
Text = Loc.GetString("Full name:")
}),
(_fullNameLineEdit = new LineEdit
{
@@ -83,14 +80,14 @@ namespace Content.Client.GameObjects.Components.Access
}),
(_fullNameSaveButton = new Button
{
Text = loc.GetString("Save"),
Text = Loc.GetString("Save"),
Disabled = true
}),
// Title
(_jobTitleLabel = new Label
{
Text = loc.GetString("Job title:")
Text = Loc.GetString("Job title:")
}),
(_jobTitleLineEdit = new LineEdit
{
@@ -98,7 +95,7 @@ namespace Content.Client.GameObjects.Components.Access
}),
(_jobTitleSaveButton = new Button
{
Text = loc.GetString("Save"),
Text = Loc.GetString("Save"),
Disabled = true
}),
},
@@ -148,14 +145,14 @@ namespace Content.Client.GameObjects.Components.Access
public void UpdateState(IdCardConsoleBoundUserInterfaceState state)
{
_privilegedIdButton.Text = state.IsPrivilegedIdPresent
? _loc.GetString("Eject")
: _loc.GetString("Insert");
? Loc.GetString("Eject")
: Loc.GetString("Insert");
_privilegedIdLabel.Text = state.PrivilegedIdName;
_targetIdButton.Text = state.IsTargetIdPresent
? _loc.GetString("Eject")
: _loc.GetString("Insert");
? Loc.GetString("Eject")
: Loc.GetString("Insert");
_targetIdLabel.Text = state.TargetIdName;

View File

@@ -14,7 +14,6 @@ namespace Content.Client.GameObjects.Components.Actor
[RegisterComponent]
public sealed class CharacterInfoComponent : Component, ICharacterUI
{
[Dependency] private readonly ILocalizationManager _loc = default!;
[Dependency] private readonly IResourceCache _resourceCache = default!;
private CharacterInfoControl _control;
@@ -28,7 +27,7 @@ namespace Content.Client.GameObjects.Components.Actor
{
base.OnAdd();
Scene = _control = new CharacterInfoControl(_resourceCache, _loc);
Scene = _control = new CharacterInfoControl(_resourceCache);
}
public override void Initialize()
@@ -42,7 +41,7 @@ namespace Content.Client.GameObjects.Components.Actor
_control.NameLabel.Text = Owner.Name;
// ReSharper disable once StringLiteralTypo
_control.SubText.Text = _loc.GetString("Professional Greyshirt");
_control.SubText.Text = Loc.GetString("Professional Greyshirt");
}
private sealed class CharacterInfoControl : VBoxContainer
@@ -51,7 +50,7 @@ namespace Content.Client.GameObjects.Components.Actor
public Label NameLabel { get; }
public Label SubText { get; }
public CharacterInfoControl(IResourceCache resourceCache, ILocalizationManager loc)
public CharacterInfoControl(IResourceCache resourceCache)
{
AddChild(new HBoxContainer
{
@@ -76,17 +75,17 @@ namespace Content.Client.GameObjects.Components.Actor
AddChild(new Placeholder(resourceCache)
{
PlaceholderText = loc.GetString("Health & status effects")
PlaceholderText = Loc.GetString("Health & status effects")
});
AddChild(new Placeholder(resourceCache)
{
PlaceholderText = loc.GetString("Objectives")
PlaceholderText = Loc.GetString("Objectives")
});
AddChild(new Placeholder(resourceCache)
{
PlaceholderText = loc.GetString("Antagonist Roles")
PlaceholderText = Loc.GetString("Antagonist Roles")
});
}
}

View File

@@ -18,7 +18,6 @@ namespace Content.Client.GameObjects.Components.HUD.Inventory
[UsedImplicitly]
public class HumanInventoryInterfaceController : InventoryInterfaceController
{
[Dependency] private readonly ILocalizationManager _loc = default!;
[Dependency] private readonly IResourceCache _resourceCache = default!;
[Dependency] private readonly IItemSlotManager _itemSlotManager = default!;
@@ -40,7 +39,7 @@ namespace Content.Client.GameObjects.Components.HUD.Inventory
{
base.Initialize();
_window = new HumanInventoryWindow(_loc, _resourceCache);
_window = new HumanInventoryWindow(_resourceCache);
_window.OnClose += () => GameHud.InventoryButtonDown = false;
foreach (var (slot, button) in _window.Buttons)
{
@@ -192,9 +191,9 @@ namespace Content.Client.GameObjects.Components.HUD.Inventory
public IReadOnlyDictionary<Slots, ItemSlotButton> Buttons { get; }
public HumanInventoryWindow(ILocalizationManager loc, IResourceCache resourceCache)
public HumanInventoryWindow(IResourceCache resourceCache)
{
Title = loc.GetString("Your Inventory");
Title = Loc.GetString("Your Inventory");
Resizable = false;
var buttonDict = new Dictionary<Slots, ItemSlotButton>();

View File

@@ -32,8 +32,6 @@ namespace Content.Client.Research
private ItemList _unlockableTechnologies;
private ItemList _futureTechnologies;
[Dependency] private readonly ILocalizationManager _localizationManager = default!;
public Button UnlockButton { get; private set; }
public Button ServerSelectionButton { get; private set; }
public Button ServerSyncButton { get; private set; }
@@ -44,7 +42,7 @@ namespace Content.Client.Research
{
IoCManager.InjectDependencies(this);
Title = _localizationManager.GetString("R&D Console");
Title = Loc.GetString("R&D Console");
Owner = owner;
@@ -110,8 +108,8 @@ namespace Content.Client.Research
SizeFlagsStretchRatio = 3,
};
_pointLabel = new Label() { Text = _localizationManager.GetString("Research Points") + ": 0" };
_pointsPerSecondLabel = new Label() { Text = _localizationManager.GetString("Points per Second") + ": 0" };
_pointLabel = new Label() { Text = Loc.GetString("Research Points") + ": 0" };
_pointsPerSecondLabel = new Label() { Text = Loc.GetString("Points per Second") + ": 0" };
var vboxPointsButtons = new VBoxContainer()
{
@@ -120,9 +118,9 @@ namespace Content.Client.Research
SizeFlagsVertical = SizeFlags.FillExpand,
};
ServerSelectionButton = new Button() { Text = _localizationManager.GetString("Server list") };
ServerSyncButton = new Button() { Text = _localizationManager.GetString("Sync")};
UnlockButton = new Button() { Text = _localizationManager.GetString("Unlock"), Disabled = true };
ServerSelectionButton = new Button() { Text = Loc.GetString("Server list") };
ServerSyncButton = new Button() { Text = Loc.GetString("Sync")};
UnlockButton = new Button() { Text = Loc.GetString("Unlock"), Disabled = true };
vboxPointsButtons.AddChild(ServerSelectionButton);
@@ -268,8 +266,8 @@ namespace Content.Client.Research
_technologyIcon.Texture = TechnologySelected.Icon.Frame0();
_technologyName.Text = TechnologySelected.Name;
_technologyDescription.Text = TechnologySelected.Description+$"\n{TechnologySelected.RequiredPoints} " + _localizationManager.GetString("research points");
_technologyRequirements.Text = _localizationManager.GetString("No technology requirements.");
_technologyDescription.Text = TechnologySelected.Description+$"\n{TechnologySelected.RequiredPoints} " + Loc.GetString("research points");
_technologyRequirements.Text = Loc.GetString("No technology requirements.");
var prototypeMan = IoCManager.Resolve<IPrototypeManager>();
@@ -278,7 +276,7 @@ namespace Content.Client.Research
var requiredId = TechnologySelected.RequiredTechnologies[i];
if (!prototypeMan.TryIndex(requiredId, out TechnologyPrototype prototype)) continue;
if (i == 0)
_technologyRequirements.Text = _localizationManager.GetString("Requires") + $": {prototype.Name}";
_technologyRequirements.Text = Loc.GetString("Requires") + $": {prototype.Name}";
else
_technologyRequirements.Text += $", {prototype.Name}";
}
@@ -289,8 +287,8 @@ namespace Content.Client.Research
/// </summary>
public void PopulatePoints()
{
_pointLabel.Text = _localizationManager.GetString("Research Points") + $": {Owner.Points}";
_pointsPerSecondLabel.Text = _localizationManager.GetString("Points per second") + $": {Owner.PointsPerSecond}";
_pointLabel.Text = Loc.GetString("Research Points") + $": {Owner.Points}";
_pointsPerSecondLabel.Text = Loc.GetString("Points per second") + $": {Owner.PointsPerSecond}";
}
/// <summary>

View File

@@ -31,7 +31,7 @@ namespace Content.Client.Sandbox
public Button ShowMarkersButton; //Shows spawn points
public Button ShowBbButton; //Shows bounding boxes
public SandboxWindow(ILocalizationManager loc)
public SandboxWindow()
{
Resizable = false;
@@ -40,34 +40,34 @@ namespace Content.Client.Sandbox
var vBox = new VBoxContainer { SeparationOverride = 4 };
Contents.AddChild(vBox);
RespawnButton = new Button { Text = loc.GetString("Respawn") };
RespawnButton = new Button { Text = Loc.GetString("Respawn") };
vBox.AddChild(RespawnButton);
SpawnEntitiesButton = new Button { Text = loc.GetString("Spawn Entities") };
SpawnEntitiesButton = new Button { Text = Loc.GetString("Spawn Entities") };
vBox.AddChild(SpawnEntitiesButton);
SpawnTilesButton = new Button { Text = loc.GetString("Spawn Tiles") };
SpawnTilesButton = new Button { Text = Loc.GetString("Spawn Tiles") };
vBox.AddChild(SpawnTilesButton);
GiveFullAccessButton = new Button { Text = loc.GetString("Give AA Id") };
GiveFullAccessButton = new Button { Text = Loc.GetString("Give AA Id") };
vBox.AddChild(GiveFullAccessButton);
GiveAghostButton = new Button { Text = loc.GetString("Ghost") };
GiveAghostButton = new Button { Text = Loc.GetString("Ghost") };
vBox.AddChild(GiveAghostButton);
ToggleLightButton = new Button { Text = loc.GetString("Toggle Lights"), ToggleMode = true };
ToggleLightButton = new Button { Text = Loc.GetString("Toggle Lights"), ToggleMode = true };
vBox.AddChild(ToggleLightButton);
ToggleSubfloorButton = new Button { Text = loc.GetString("Toggle Subfloor"), ToggleMode = true };
ToggleSubfloorButton = new Button { Text = Loc.GetString("Toggle Subfloor"), ToggleMode = true };
vBox.AddChild(ToggleSubfloorButton);
SuicideButton = new Button { Text = loc.GetString("Suicide") };
SuicideButton = new Button { Text = Loc.GetString("Suicide") };
vBox.AddChild(SuicideButton);
ShowMarkersButton = new Button { Text = loc.GetString("Show Spawns"), ToggleMode = true };
ShowMarkersButton = new Button { Text = Loc.GetString("Show Spawns"), ToggleMode = true };
vBox.AddChild(ShowMarkersButton);
ShowBbButton = new Button { Text = loc.GetString("Show Bb"), ToggleMode = true };
ShowBbButton = new Button { Text = Loc.GetString("Show Bb"), ToggleMode = true };
vBox.AddChild(ShowBbButton);
}
}
@@ -163,7 +163,7 @@ namespace Content.Client.Sandbox
return;
}
_window = new SandboxWindow(_localization);
_window = new SandboxWindow();
_window.OnClose += WindowOnOnClose;

View File

@@ -31,7 +31,6 @@ namespace Content.Client.State
[Dependency] private readonly IClientNetManager _netManager = default!;
[Dependency] private readonly IConfigurationManager _configurationManager = default!;
[Dependency] private readonly IGameController _controllerProxy = default!;
[Dependency] private readonly ILocalizationManager _loc = default!;
[Dependency] private readonly IResourceCache _resourceCache = default!;
[Dependency] private readonly IUserInterfaceManager _userInterfaceManager = default!;
@@ -105,10 +104,10 @@ namespace Content.Client.State
var inputName = _mainMenuControl.UserNameBox.Text.Trim();
if (!UsernameHelpers.IsNameValid(inputName, out var reason))
{
var invalidReason = _loc.GetString(reason.ToText());
var invalidReason = Loc.GetString(reason.ToText());
_userInterfaceManager.Popup(
_loc.GetString("Invalid username:\n{0}", invalidReason),
_loc.GetString("Invalid Username"));
Loc.GetString("Invalid username:\n{0}", invalidReason),
Loc.GetString("Invalid Username"));
return;
}

View File

@@ -15,8 +15,6 @@ namespace Content.Client.UserInterface.Cargo
{
public class CargoConsoleMenu : SS14Window
{
[Dependency] private readonly ILocalizationManager _loc = default!;
protected override Vector2? CustomSize => (400, 600);
public CargoConsoleBoundUserInterface Owner { get; private set; }
@@ -48,15 +46,15 @@ namespace Content.Client.UserInterface.Cargo
Owner = owner;
if (Owner.RequestOnly)
Title = _loc.GetString("Cargo Request Console");
Title = Loc.GetString("Cargo Request Console");
else
Title = _loc.GetString("Cargo Shuttle Console");
Title = Loc.GetString("Cargo Shuttle Console");
var rows = new VBoxContainer();
var accountName = new HBoxContainer();
var accountNameLabel = new Label {
Text = _loc.GetString("Account Name: "),
Text = Loc.GetString("Account Name: "),
StyleClasses = { StyleNano.StyleClassLabelKeyText }
};
_accountNameLabel = new Label {
@@ -69,7 +67,7 @@ namespace Content.Client.UserInterface.Cargo
var points = new HBoxContainer();
var pointsLabel = new Label
{
Text = _loc.GetString("Points: "),
Text = Loc.GetString("Points: "),
StyleClasses = { StyleNano.StyleClassLabelKeyText }
};
_pointsLabel = new Label
@@ -83,12 +81,12 @@ namespace Content.Client.UserInterface.Cargo
var shuttleStatus = new HBoxContainer();
var shuttleStatusLabel = new Label
{
Text = _loc.GetString("Shuttle Status: "),
Text = Loc.GetString("Shuttle Status: "),
StyleClasses = { StyleNano.StyleClassLabelKeyText }
};
_shuttleStatusLabel = new Label
{
Text = _loc.GetString("Away") // Shuttle.Status
Text = Loc.GetString("Away") // Shuttle.Status
};
shuttleStatus.AddChild(shuttleStatusLabel);
shuttleStatus.AddChild(_shuttleStatusLabel);
@@ -97,7 +95,7 @@ namespace Content.Client.UserInterface.Cargo
var shuttleCapacity = new HBoxContainer();
var shuttleCapacityLabel = new Label
{
Text = _loc.GetString("Order Capacity: "),
Text = Loc.GetString("Order Capacity: "),
StyleClasses = { StyleNano.StyleClassLabelKeyText }
};
_shuttleCapacityLabel = new Label
@@ -111,13 +109,13 @@ namespace Content.Client.UserInterface.Cargo
var buttons = new HBoxContainer();
CallShuttleButton = new Button()
{
Text = _loc.GetString("Call Shuttle"),
Text = Loc.GetString("Call Shuttle"),
TextAlign = Label.AlignMode.Center,
SizeFlagsHorizontal = SizeFlags.FillExpand
};
PermissionsButton = new Button()
{
Text = _loc.GetString("Permissions"),
Text = Loc.GetString("Permissions"),
TextAlign = Label.AlignMode.Center
};
buttons.AddChild(CallShuttleButton);
@@ -127,13 +125,13 @@ namespace Content.Client.UserInterface.Cargo
var category = new HBoxContainer();
_categories = new OptionButton
{
Prefix = _loc.GetString("Categories: "),
Prefix = Loc.GetString("Categories: "),
SizeFlagsHorizontal = SizeFlags.FillExpand,
SizeFlagsStretchRatio = 1
};
_searchBar = new LineEdit
{
PlaceHolder = _loc.GetString("Search"),
PlaceHolder = Loc.GetString("Search"),
SizeFlagsHorizontal = SizeFlags.FillExpand,
SizeFlagsStretchRatio = 1
};
@@ -166,14 +164,14 @@ namespace Content.Client.UserInterface.Cargo
SizeFlagsVertical = SizeFlags.FillExpand
};
var rAndOVBox = new VBoxContainer();
var requestsLabel = new Label { Text = _loc.GetString("Requests") };
var requestsLabel = new Label { Text = Loc.GetString("Requests") };
_requests = new VBoxContainer // replace with scroll box so that approval buttons can be added
{
StyleClasses = { "transparentItemList" },
SizeFlagsVertical = SizeFlags.FillExpand,
SizeFlagsStretchRatio = 1,
};
var ordersLabel = new Label { Text = _loc.GetString("Orders") };
var ordersLabel = new Label { Text = Loc.GetString("Orders") };
_orders = new VBoxContainer
{
StyleClasses = { "transparentItemList" },
@@ -262,14 +260,14 @@ namespace Content.Client.UserInterface.Cargo
_categoryStrings.Clear();
_categories.Clear();
_categoryStrings.Add(_loc.GetString("All"));
_categoryStrings.Add(Loc.GetString("All"));
var search = _searchBar.Text.Trim().ToLowerInvariant();
foreach (var prototype in Owner.Market.Products)
{
if (!_categoryStrings.Contains(prototype.Category))
{
_categoryStrings.Add(_loc.GetString(prototype.Category));
_categoryStrings.Add(Loc.GetString(prototype.Category));
}
}
_categoryStrings.Sort();

View File

@@ -8,8 +8,6 @@ namespace Content.Client.UserInterface.Cargo
{
class CargoConsoleOrderMenu : SS14Window
{
[Dependency] private readonly ILocalizationManager _loc = default!;
public LineEdit Requester { get; set; }
public LineEdit Reason { get; set; }
public SpinBox Amount { get; set; }
@@ -19,22 +17,22 @@ namespace Content.Client.UserInterface.Cargo
{
IoCManager.InjectDependencies(this);
Title = _loc.GetString("Order Form");
Title = Loc.GetString("Order Form");
var vBox = new VBoxContainer();
var gridContainer = new GridContainer { Columns = 2 };
var requesterLabel = new Label { Text = _loc.GetString("Name:") };
var requesterLabel = new Label { Text = Loc.GetString("Name:") };
Requester = new LineEdit();
gridContainer.AddChild(requesterLabel);
gridContainer.AddChild(Requester);
var reasonLabel = new Label { Text = _loc.GetString("Reason:") };
var reasonLabel = new Label { Text = Loc.GetString("Reason:") };
Reason = new LineEdit();
gridContainer.AddChild(reasonLabel);
gridContainer.AddChild(Reason);
var amountLabel = new Label { Text = _loc.GetString("Amount:") };
var amountLabel = new Label { Text = Loc.GetString("Amount:") };
Amount = new SpinBox
{
SizeFlagsHorizontal = SizeFlags.FillExpand,
@@ -51,7 +49,7 @@ namespace Content.Client.UserInterface.Cargo
SubmitButton = new Button()
{
Text = _loc.GetString("OK"),
Text = Loc.GetString("OK"),
TextAlign = Label.AlignMode.Center,
};
vBox.AddChild(SubmitButton);

View File

@@ -10,8 +10,6 @@ namespace Content.Client.UserInterface.Cargo
{
public class GalacticBankSelectionMenu : SS14Window
{
[Dependency] private readonly ILocalizationManager _loc = default!;
private ItemList _accounts;
private int _accountCount = 0;
private string[] _accountNames = new string[] { };
@@ -26,7 +24,7 @@ namespace Content.Client.UserInterface.Cargo
{
IoCManager.InjectDependencies(this);
Title = _loc.GetString("Galactic Bank Selection");
Title = Loc.GetString("Galactic Bank Selection");
_accounts = new ItemList() { SelectMode = ItemList.ItemListSelectMode.Single };

View File

@@ -9,16 +9,14 @@ namespace Content.Client.UserInterface
internal sealed class EscapeMenu : SS14Window
{
private readonly IClientConsole _console;
private readonly ILocalizationManager _localizationManager;
private BaseButton DisconnectButton;
private BaseButton QuitButton;
private BaseButton OptionsButton;
private OptionsMenu optionsMenu;
public EscapeMenu(IClientConsole console, ILocalizationManager localizationManager)
public EscapeMenu(IClientConsole console)
{
_localizationManager = localizationManager;
_console = console;
IoCManager.InjectDependencies(this);
@@ -37,15 +35,15 @@ namespace Content.Client.UserInterface
var vBox = new VBoxContainer {SeparationOverride = 4};
Contents.AddChild(vBox);
OptionsButton = new Button {Text = _localizationManager.GetString("Options")};
OptionsButton = new Button {Text = Loc.GetString("Options")};
OptionsButton.OnPressed += OnOptionsButtonClicked;
vBox.AddChild(OptionsButton);
DisconnectButton = new Button {Text = _localizationManager.GetString("Disconnect")};
DisconnectButton = new Button {Text = Loc.GetString("Disconnect")};
DisconnectButton.OnPressed += OnDisconnectButtonClicked;
vBox.AddChild(DisconnectButton);
QuitButton = new Button {Text = _localizationManager.GetString("Quit Game")};
QuitButton = new Button {Text = Loc.GetString("Quit Game")};
QuitButton.OnPressed += OnQuitButtonClicked;
vBox.AddChild(QuitButton);
}

View File

@@ -76,7 +76,6 @@ namespace Content.Client.UserInterface
private VBoxContainer _combatPanelContainer;
[Dependency] private readonly IResourceCache _resourceCache = default!;
[Dependency] private readonly ILocalizationManager _loc = default!;
[Dependency] private readonly IInputManager _inputManager = default!;
public Control HandsContainer { get; private set; }
@@ -130,7 +129,7 @@ namespace Content.Client.UserInterface
// Escape
_buttonEscapeMenu = new TopButton(escapeTexture, "Esc")
{
ToolTip = _loc.GetString("Open escape menu.")
ToolTip = Loc.GetString("Open escape menu.")
};
_topButtonsContainer.AddChild(_buttonEscapeMenu);
@@ -140,7 +139,7 @@ namespace Content.Client.UserInterface
// Tutorial
_buttonTutorial = new TopButton(tutorialTexture, "F1")
{
ToolTip = _loc.GetString("Open tutorial.")
ToolTip = Loc.GetString("Open tutorial.")
};
_topButtonsContainer.AddChild(_buttonTutorial);
@@ -150,7 +149,7 @@ namespace Content.Client.UserInterface
// Character
_buttonCharacterMenu = new TopButton(characterTexture, "C")
{
ToolTip = _loc.GetString("Open character menu."),
ToolTip = Loc.GetString("Open character menu."),
Visible = false
};
@@ -161,7 +160,7 @@ namespace Content.Client.UserInterface
// Inventory
_buttonInventoryMenu = new TopButton(inventoryTexture, "I")
{
ToolTip = _loc.GetString("Open inventory menu."),
ToolTip = Loc.GetString("Open inventory menu."),
Visible = false
};
@@ -172,7 +171,7 @@ namespace Content.Client.UserInterface
// Crafting
_buttonCraftingMenu = new TopButton(craftingTexture, "G")
{
ToolTip = _loc.GetString("Open crafting menu."),
ToolTip = Loc.GetString("Open crafting menu."),
Visible = false
};
@@ -183,7 +182,7 @@ namespace Content.Client.UserInterface
// Sandbox
_buttonSandboxMenu = new TopButton(sandboxTexture, "B")
{
ToolTip = _loc.GetString("Open sandbox menu."),
ToolTip = Loc.GetString("Open sandbox menu."),
Visible = false
};
@@ -220,7 +219,7 @@ namespace Content.Client.UserInterface
{
(_combatModeButton = new Button
{
Text = _loc.GetString("Combat Mode"),
Text = Loc.GetString("Combat Mode"),
ToggleMode = true
}),
(_targetingDoll = new TargetingDoll(_resourceCache))

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!;