diff --git a/Content.Server/GameObjects/Components/Chemistry/SolutionComponent.cs b/Content.Server/GameObjects/Components/Chemistry/SolutionComponent.cs index 1c5f0a0d77..83a54d4779 100644 --- a/Content.Server/GameObjects/Components/Chemistry/SolutionComponent.cs +++ b/Content.Server/GameObjects/Components/Chemistry/SolutionComponent.cs @@ -22,7 +22,7 @@ namespace Content.Server.GameObjects.Components.Chemistry { #pragma warning disable 649 [Dependency] private readonly IPrototypeManager _prototypeManager; - [Dependency] private readonly ILocalizationManager _localizationManager; + [Dependency] private readonly ILocalizationManager _loc; [Dependency] private readonly IEntitySystemManager _entitySystemManager; #pragma warning restore 649 @@ -42,7 +42,7 @@ namespace Content.Server.GameObjects.Components.Chemistry /// [Verb] private sealed class FillTargetVerb : Verb - { + { protected override string GetText(IEntity user, SolutionComponent component) { if(!user.TryGetComponent(out var hands)) @@ -103,7 +103,7 @@ namespace Content.Server.GameObjects.Components.Chemistry void IExamine.Examine(FormattedMessage message) { - message.AddText(_localizationManager.GetString("Contains:\n")); + message.AddText(_loc.GetString("Contains:\n")); foreach (var reagent in ReagentList) { if (_prototypeManager.TryIndex(reagent.ReagentId, out ReagentPrototype proto)) @@ -112,7 +112,7 @@ namespace Content.Server.GameObjects.Components.Chemistry } else { - message.AddText(_localizationManager.GetString("Unknown reagent:") + $"{reagent.Quantity}u\n"); + message.AddText(_loc.GetString("Unknown reagent: {0}u\n", reagent.Quantity)); } } } diff --git a/Content.Server/GameObjects/Components/Interactable/HandheldLightComponent.cs b/Content.Server/GameObjects/Components/Interactable/HandheldLightComponent.cs index a9f0c68220..54fee05d1f 100644 --- a/Content.Server/GameObjects/Components/Interactable/HandheldLightComponent.cs +++ b/Content.Server/GameObjects/Components/Interactable/HandheldLightComponent.cs @@ -77,9 +77,11 @@ namespace Content.Server.GameObjects.Components.Interactable void IExamine.Examine(FormattedMessage message) { + var loc = IoCManager.Resolve(); + if (Activated) { - message.AddText("The light is currently on."); + message.AddMarkup(loc.GetString("The light is currently [color=darkgreen]on[/color].")); } } diff --git a/Content.Server/GameObjects/Components/Interactable/Tools/WelderComponent.cs b/Content.Server/GameObjects/Components/Interactable/Tools/WelderComponent.cs index 0168ad739a..9360d3860f 100644 --- a/Content.Server/GameObjects/Components/Interactable/Tools/WelderComponent.cs +++ b/Content.Server/GameObjects/Components/Interactable/Tools/WelderComponent.cs @@ -2,6 +2,8 @@ using Content.Server.GameObjects.EntitySystems; using Robust.Server.GameObjects; using Robust.Shared.GameObjects; +using Robust.Shared.IoC; +using Robust.Shared.Localization; using Robust.Shared.Maths; using Robust.Shared.Serialization; using Robust.Shared.Utility; @@ -148,21 +150,18 @@ namespace Content.Server.GameObjects.Components.Interactable.Tools void IExamine.Examine(FormattedMessage message) { + var loc = IoCManager.Resolve(); if (Activated) { - message.PushColor(Color.Orange); - message.AddText("Lit\n"); - message.Pop(); + message.AddMarkup(loc.GetString("[color=orange]Lit[/color]\n")); } else { - message.AddText("Not lit\n"); + message.AddText(loc.GetString("Not lit\n")); } - message.AddText("Fuel: "); - message.PushColor(Fuel < FuelCapacity / 4f ? Color.DarkOrange : Color.Orange); - message.AddText($"{Math.Round(Fuel)}/{FuelCapacity}"); - message.AddText("."); - message.Pop(); + + message.AddMarkup(loc.GetString("Fuel: [color={0}]{1}/{2}[/color].", + Fuel < FuelCapacity / 4f ? "darkorange" : "orange", Math.Round(Fuel), FuelCapacity)); } } } diff --git a/Content.Server/GameObjects/Components/Items/DiceComponent.cs b/Content.Server/GameObjects/Components/Items/DiceComponent.cs index 1dc5939f00..eda5569dd5 100644 --- a/Content.Server/GameObjects/Components/Items/DiceComponent.cs +++ b/Content.Server/GameObjects/Components/Items/DiceComponent.cs @@ -1,4 +1,3 @@ -using System; using Content.Server.GameObjects.Components.Sound; using Content.Server.GameObjects.EntitySystems; using Content.Shared.Audio; @@ -7,7 +6,7 @@ using Robust.Shared.Audio; using Robust.Shared.GameObjects; using Robust.Shared.Interfaces.Random; using Robust.Shared.IoC; -using Robust.Shared.Maths; +using Robust.Shared.Localization; using Robust.Shared.Prototypes; using Robust.Shared.Random; using Robust.Shared.Serialization; @@ -81,17 +80,11 @@ namespace Content.Server.GameObjects.Components.Items Roll(); } - public void Examine(FormattedMessage message) + void IExamine.Examine(FormattedMessage message) { - message.AddText("A dice with "); - message.PushColor(new Color(1F, 0.75F, 0.75F)); - message.AddText(_sides.ToString()); - message.Pop(); - message.AddText(" sides.\nIt has landed on a "); - message.PushColor(new Color(1F, 1F, 1F)); - message.AddText(_currentSide.ToString()); - message.Pop(); - message.AddText("."); + var loc = IoCManager.Resolve(); + message.AddMarkup(loc.GetString("A dice with [color=lightgray]{0}[/color] sides.\n" + + "It has landed on a [color=white]{1}[/color].", _sides, _currentSide)); } } } diff --git a/Content.Server/GameObjects/Components/Power/PowerDevice.cs b/Content.Server/GameObjects/Components/Power/PowerDevice.cs index 102ef20924..d155ece11c 100644 --- a/Content.Server/GameObjects/Components/Power/PowerDevice.cs +++ b/Content.Server/GameObjects/Components/Power/PowerDevice.cs @@ -221,11 +221,7 @@ namespace Content.Server.GameObjects.Components.Power if (!Powered) { - message.AddText(loc.GetString("The device is ")); - message.PushColor(Color.Orange); - message.AddText(loc.GetString("not powered")); - message.Pop(); - message.AddText("."); + message.AddMarkup(loc.GetString("The device is [color=orange]not powered[/color].")); } } diff --git a/Content.Server/GameObjects/Components/Power/PowerStorageComponent.cs b/Content.Server/GameObjects/Components/Power/PowerStorageComponent.cs index 064e184a72..e2d686eddb 100644 --- a/Content.Server/GameObjects/Components/Power/PowerStorageComponent.cs +++ b/Content.Server/GameObjects/Components/Power/PowerStorageComponent.cs @@ -7,6 +7,7 @@ using Robust.Shared.Utility; using System; using System.Globalization; using Content.Server.GameObjects.EntitySystems; +using Robust.Shared.Localization; using Robust.Shared.Maths; using Robust.Shared.ViewVariables; using YamlDotNet.RepresentationModel; @@ -167,13 +168,16 @@ namespace Content.Server.GameObjects.Components.Power } AddCharge(RequestCharge(frameTime)); } - + /// public void Examine(FormattedMessage message) { - message.PushColor(Color.Yellow); - var chargePercent = Math.Round(100*(Capacity != 0f ? (Charge/Capacity) : 1f), 2).ToString(NumberFormatInfo.InvariantInfo); - message.AddText($"Charge: {Math.Round(Charge, 2)}J / {Capacity}J ({chargePercent}%)\nRate: {ChargeRate}W IN, {DistributionRate}W OUT"); + var loc = IoCManager.Resolve(); + + var chargePercent = Math.Round(100*Charge/Capacity, 2); + message.AddMarkup(loc.GetString( + "[color=yellow]Charge: {0}J / {1}J ({2}%)\nRate: {3}W IN, {4}W OUT[/color]", + Math.Round(Charge, 2), Capacity, chargePercent, ChargeRate, DistributionRate)); } } } diff --git a/Content.Server/GameObjects/Components/Stack/StackComponent.cs b/Content.Server/GameObjects/Components/Stack/StackComponent.cs index 47668223ab..5391980d03 100644 --- a/Content.Server/GameObjects/Components/Stack/StackComponent.cs +++ b/Content.Server/GameObjects/Components/Stack/StackComponent.cs @@ -3,6 +3,7 @@ using Content.Server.GameObjects.EntitySystems; using Robust.Shared.GameObjects; using Robust.Shared.Interfaces.Reflection; using Robust.Shared.IoC; +using Robust.Shared.Localization; using Robust.Shared.Serialization; using Robust.Shared.Utility; using Robust.Shared.ViewVariables; @@ -117,7 +118,10 @@ namespace Content.Server.GameObjects.Components.Stack void IExamine.Examine(FormattedMessage message) { - message.AddText($"There are {Count} things in the stack."); + var loc = IoCManager.Resolve(); + message.AddMarkup(loc.GetPluralString( + "There is [color=lightgray]1[/color] thing in the stack", + "There are [color=lightgray]{0}[/color] things in the stack.", Count, Count)); } } diff --git a/Content.Server/GameObjects/Components/WiresComponent.cs b/Content.Server/GameObjects/Components/WiresComponent.cs index 73ac084b78..888e93f572 100644 --- a/Content.Server/GameObjects/Components/WiresComponent.cs +++ b/Content.Server/GameObjects/Components/WiresComponent.cs @@ -1,7 +1,6 @@ using System; using System.Collections.Generic; using System.Linq; -using Content.Server.GameObjects.Components.Doors; using Content.Server.GameObjects.Components.Interactable.Tools; using Content.Server.GameObjects.Components.VendingMachines; using Content.Server.GameObjects.EntitySystems; @@ -301,15 +300,10 @@ namespace Content.Server.GameObjects.Components void IExamine.Examine(FormattedMessage message) { var loc = IoCManager.Resolve(); - message.AddText(loc.GetString("The ")); - message.PushColor(Color.LightGray); - message.AddText(loc.GetString("maintenance panel")); - message.Pop(); - message.AddText(loc.GetString(" is ")); - message.PushColor(IsPanelOpen ? Color.DarkGreen : Color.DarkRed); - message.AddText(loc.GetString(IsPanelOpen ? "open" : "closed")); - message.Pop(); - message.AddText("."); + + message.AddMarkup(loc.GetString(IsPanelOpen + ? "The [color=lightgray]maintenance panel[/color] is [color=darkgreen]open[/color]." + : "The [color=lightgray]maintenance panel[/color] is [color=darkred]closed[/color].")); } public void SetStatus(object statusIdentifier, string newMessage)