localize air alarm gas names (#3336)

Co-authored-by: deltanedas <@deltanedas:kde.org>
This commit is contained in:
deltanedas 2025-03-29 20:44:14 +00:00 committed by GitHub
parent 15fee4bc3c
commit adb3385b10
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 13 additions and 3 deletions

View File

@ -1,4 +1,5 @@
using Content.Shared.Atmos;
using Content.Shared.Atmos.EntitySystems; // DeltaV
using Content.Shared.Atmos.Monitor.Components;
using Content.Shared.Atmos.Piping.Unary.Components;
using Robust.Client.AutoGenerated;
@ -10,6 +11,8 @@ namespace Content.Client.Atmos.Monitor.UI.Widgets;
[GenerateTypedNameReferences]
public sealed partial class ScrubberControl : BoxContainer
{
[Dependency] private readonly IEntityManager _entMan = default!; // DeltaV
private readonly SharedAtmosphereSystem _atmos; // DeltaV
private GasVentScrubberData _data;
private string _address;
@ -29,6 +32,8 @@ public sealed partial class ScrubberControl : BoxContainer
public ScrubberControl(GasVentScrubberData data, string address)
{
RobustXamlLoader.Load(this);
IoCManager.InjectDependencies(this); // DeltaV
_atmos = _entMan.System<SharedAtmosphereSystem>(); // DeltaV
Name = address;
@ -82,7 +87,7 @@ public sealed partial class ScrubberControl : BoxContainer
var gasButton = new Button
{
Name = value.ToString(),
Text = Loc.GetString($"{value}"),
Text = Loc.GetString(_atmos.GetGas(value).Name), // DeltaV - localize it instead of showing the enum name
ToggleMode = true,
HorizontalExpand = true,
Pressed = _data.FilterGases.Contains(value)

View File

@ -1,5 +1,6 @@
using Content.Client.Message;
using Content.Shared.Atmos;
using Content.Shared.Atmos.EntitySystems; // DeltaV
using Content.Shared.Atmos.Monitor;
using Content.Shared.Temperature;
using Robust.Client.AutoGenerated;
@ -11,6 +12,8 @@ namespace Content.Client.Atmos.Monitor.UI.Widgets;
[GenerateTypedNameReferences]
public sealed partial class SensorInfo : BoxContainer
{
[Dependency] private readonly IEntityManager _entMan = default!; // DeltaV
private readonly SharedAtmosphereSystem _atmos; // DeltaV
public Action<string, AtmosMonitorThresholdType, AtmosAlarmThreshold, Gas?>? OnThresholdUpdate;
public event Action<AtmosSensorData>? SensorDataCopied;
private string _address;
@ -24,6 +27,8 @@ public sealed partial class SensorInfo : BoxContainer
public SensorInfo(AtmosSensorData data, string address)
{
RobustXamlLoader.Load(this);
IoCManager.InjectDependencies(this); // DeltaV
_atmos = _entMan.System<SharedAtmosphereSystem>(); // DeltaV
_address = address;
@ -46,7 +51,7 @@ public sealed partial class SensorInfo : BoxContainer
var fractionGas = amount / data.TotalMoles;
label.SetMarkup(Loc.GetString("air-alarm-ui-gases-indicator",
("gas", $"{gas}"),
("gas", Loc.GetString(_atmos.GetGas(gas).Name)), // DeltaV - localize it instead of showing the enum name
("color", AirAlarmWindow.ColorForThreshold(fractionGas, data.GasThresholds[gas])),
("amount", $"{amount:0.####}"),
("percentage", $"{(100 * fractionGas):0.##}")));
@ -113,7 +118,7 @@ public sealed partial class SensorInfo : BoxContainer
var fractionGas = amount / data.TotalMoles;
label.SetMarkup(Loc.GetString("air-alarm-ui-gases-indicator",
("gas", $"{gas}"),
("gas", Loc.GetString(_atmos.GetGas(gas).Name)), // DeltaV - localize it instead of showing the enum name
("color", AirAlarmWindow.ColorForThreshold(fractionGas, data.GasThresholds[gas])),
("amount", $"{amount:0.####}"),
("percentage", $"{(100 * fractionGas):0.##}")));