]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
localization support to air alarms, wire panels and more (#39307)
authorSer11y <160628372+Ser1-1y@users.noreply.github.com>
Tue, 5 Aug 2025 15:13:04 +0000 (18:13 +0300)
committerGitHub <noreply@github.com>
Tue, 5 Aug 2025 15:13:04 +0000 (17:13 +0200)
* Add localization to the air alarms, wire panels, network configurator list menu and loadout window

* delete unused

* redo gas localization, delete unused

* removed the extra key

* Moved and renamed air-alarm-ui-thresholds-gas-name

* Moved localization to the XAML

* Use existing strings for gas names

* it just works

* Rename _atmosphereSystem in ScrubberControl.xaml.cs

_atmosphereSystem -> atmosphereSystem

* Rename _atmosphereSystem in SensorInfo.xaml.cs

_atmosphereSystem -> atmosphereSystem

13 files changed:
Content.Client/Atmos/Monitor/UI/Widgets/PumpControl.xaml.cs
Content.Client/Atmos/Monitor/UI/Widgets/ScrubberControl.xaml
Content.Client/Atmos/Monitor/UI/Widgets/ScrubberControl.xaml.cs
Content.Client/Atmos/Monitor/UI/Widgets/SensorInfo.xaml.cs
Content.Client/Atmos/Monitor/UI/Widgets/ThresholdBoundControl.xaml
Content.Client/Atmos/Monitor/UI/Widgets/ThresholdControl.xaml
Content.Client/Lobby/UI/HumanoidProfileEditor.xaml.cs
Content.Client/NetworkConfigurator/NetworkConfiguratorConfigurationMenu.xaml
Content.Shared/Wires/SharedWiresComponent.cs
Resources/Locale/en-US/atmos/air-alarm-ui.ftl
Resources/Locale/en-US/devices/network-configurator.ftl
Resources/Locale/en-US/job/loadouts.ftl
Resources/Locale/en-US/wires/components/wires-panel-component.ftl

index 8502cd2712b39bba9135f745660d0052ad8dec32..8586049cb1f059d71156a5757d83ae3f0fa67172 100644 (file)
@@ -59,7 +59,7 @@ public sealed partial class PumpControl : BoxContainer
 
         foreach (var value in Enum.GetValues<VentPumpDirection>())
         {
-            _pumpDirection.AddItem(Loc.GetString($"{value}"), (int) value);
+            _pumpDirection.AddItem(Loc.GetString($"air-alarm-ui-pump-direction-{value.ToString().ToLower()}"), (int) value);
         }
 
         _pumpDirection.SelectId((int) _data.PumpDirection);
@@ -72,7 +72,7 @@ public sealed partial class PumpControl : BoxContainer
 
         foreach (var value in Enum.GetValues<VentPressureBound>())
         {
-            _pressureCheck.AddItem(Loc.GetString($"{value}"), (int) value);
+            _pressureCheck.AddItem(Loc.GetString($"air-alarm-ui-pressure-bound-{value.ToString().ToLower()}"), (int) value);
         }
 
         _pressureCheck.SelectId((int) _data.PressureChecks);
index 85f63731fb3f423061de4a701c62c07abf19bc5d..c26aa2cf6e09743bc38d505b3899d471f2b6d59b 100644 (file)
@@ -27,7 +27,7 @@
                 </BoxContainer>
                 <!-- Lower row: every single gas -->
                 <Collapsible Margin="2 2 2 2">
-                    <CollapsibleHeading Title="Gas filters" />
+                    <CollapsibleHeading Title="{Loc 'air-alarm-ui-widget-gas-filters'}" />
                     <CollapsibleBody Margin="20 0 0 0">
                         <BoxContainer Orientation="Vertical">
                             <BoxContainer Margin="2">
index 6a233b8c3ffb67830431836fbf5e2e47aebe1f68..70da57df2e46e76e58b201cecf26782a90ab6773 100644 (file)
@@ -1,15 +1,21 @@
 using Content.Shared.Atmos;
+using Content.Shared.Atmos.EntitySystems;
 using Content.Shared.Atmos.Monitor.Components;
 using Content.Shared.Atmos.Piping.Unary.Components;
+using Content.Shared.Atmos.Prototypes;
 using Robust.Client.AutoGenerated;
 using Robust.Client.UserInterface.Controls;
 using Robust.Client.UserInterface.XAML;
+using Robust.Shared.Prototypes;
 
 namespace Content.Client.Atmos.Monitor.UI.Widgets;
 
 [GenerateTypedNameReferences]
 public sealed partial class ScrubberControl : BoxContainer
 {
+    [Dependency] private readonly IPrototypeManager _prototypeManager = default!;
+    [Dependency] private readonly IEntityManager _entMan = default!;
+
     private GasVentScrubberData _data;
     private string _address;
 
@@ -30,6 +36,10 @@ public sealed partial class ScrubberControl : BoxContainer
 
     public ScrubberControl(GasVentScrubberData data, string address)
     {
+
+        IoCManager.InjectDependencies(this);
+        var atmosphereSystem = _entMan.System<SharedAtmosphereSystem>();
+
         RobustXamlLoader.Load(this);
 
         Name = address;
@@ -63,7 +73,7 @@ public sealed partial class ScrubberControl : BoxContainer
 
         foreach (var value in Enum.GetValues<ScrubberPumpDirection>())
         {
-            _pumpDirection.AddItem(Loc.GetString($"{value}"), (int) value);
+            _pumpDirection.AddItem(Loc.GetString($"air-alarm-ui-pump-direction-{value.ToString().ToLower()}"), (int) value);
         }
 
         _pumpDirection.SelectId((int) _data.PumpDirection);
@@ -95,10 +105,13 @@ public sealed partial class ScrubberControl : BoxContainer
 
         foreach (var value in allGases)
         {
+            ProtoId<GasPrototype> gasProtoId = atmosphereSystem.GetGas(value);
+            var gasName = _prototypeManager.Index(gasProtoId).Name;
+
             var gasButton = new Button
             {
                 Name = value.ToString(),
-                Text = Loc.GetString($"{value}"),
+                Text = Loc.GetString(gasName),
                 ToggleMode = true,
                 HorizontalExpand = true,
                 Pressed = _data.FilterGases.Contains(value)
index 9e88b0bff4b0bfbd34e980d4810f24e8ed9249c3..d9945b1accbed3fdfb59a0f3b4729f42748c7de6 100644 (file)
@@ -1,16 +1,22 @@
 using Content.Client.Message;
 using Content.Shared.Atmos;
+using Content.Shared.Atmos.EntitySystems;
 using Content.Shared.Atmos.Monitor;
+using Content.Shared.Atmos.Prototypes;
 using Content.Shared.Temperature;
 using Robust.Client.AutoGenerated;
 using Robust.Client.UserInterface.Controls;
 using Robust.Client.UserInterface.XAML;
+using Robust.Shared.Prototypes;
 
 namespace Content.Client.Atmos.Monitor.UI.Widgets;
 
 [GenerateTypedNameReferences]
 public sealed partial class SensorInfo : BoxContainer
 {
+    [Dependency] private readonly IPrototypeManager _prototypeManager = default!;
+    [Dependency] private readonly IEntityManager _entMan = default!;
+
     public Action<string, AtmosMonitorThresholdType, AtmosAlarmThreshold, Gas?>? OnThresholdUpdate;
     public event Action<AtmosSensorData>? SensorDataCopied;
     private string _address;
@@ -23,6 +29,9 @@ public sealed partial class SensorInfo : BoxContainer
 
     public SensorInfo(AtmosSensorData data, string address)
     {
+        IoCManager.InjectDependencies(this);
+        var atmosphereSystem = _entMan.System<SharedAtmosphereSystem>();
+
         RobustXamlLoader.Load(this);
 
         _address = address;
@@ -45,8 +54,12 @@ public sealed partial class SensorInfo : BoxContainer
             var label = new RichTextLabel();
 
             var fractionGas = amount / data.TotalMoles;
+
+            ProtoId<GasPrototype> gasProtoId = atmosphereSystem.GetGas(gas);
+            var gasName = _prototypeManager.Index(gasProtoId).Name;
+
             label.SetMarkup(Loc.GetString("air-alarm-ui-gases-indicator",
-                ("gas", $"{gas}"),
+                ("gas", Loc.GetString(gasName)),
                 ("color", AirAlarmWindow.ColorForThreshold(fractionGas, data.GasThresholds[gas])),
                 ("amount", $"{amount:0.####}"),
                 ("percentage", $"{(100 * fractionGas):0.##}")));
@@ -54,7 +67,7 @@ public sealed partial class SensorInfo : BoxContainer
             _gasLabels.Add(gas, label);
 
             var threshold = data.GasThresholds[gas];
-            var gasThresholdControl = new ThresholdControl(Loc.GetString($"air-alarm-ui-thresholds-gas-title", ("gas", $"{gas}")), threshold, AtmosMonitorThresholdType.Gas, gas, 100);
+            var gasThresholdControl = new ThresholdControl(Loc.GetString($"air-alarm-ui-thresholds-gas-title"), threshold, AtmosMonitorThresholdType.Gas, gas, 100);
             gasThresholdControl.Margin = new Thickness(20, 2, 2, 2);
             gasThresholdControl.ThresholdDataChanged += (type, alarmThreshold, arg3) =>
             {
@@ -90,6 +103,9 @@ public sealed partial class SensorInfo : BoxContainer
 
     public void ChangeData(AtmosSensorData data)
     {
+        IoCManager.InjectDependencies(this);
+        var atmosphereSystem = _entMan.System<SharedAtmosphereSystem>();
+
         SensorAddress.Title = Loc.GetString("air-alarm-ui-window-listing-title", ("address", _address), ("state", data.AlarmState));
 
         AlarmStateLabel.SetMarkup(Loc.GetString("air-alarm-ui-window-alarm-state-indicator",
@@ -112,8 +128,12 @@ public sealed partial class SensorInfo : BoxContainer
             }
 
             var fractionGas = amount / data.TotalMoles;
+
+            ProtoId<GasPrototype> gasProtoId = atmosphereSystem.GetGas(gas);
+            var gasName = _prototypeManager.Index(gasProtoId).Name;
+
             label.SetMarkup(Loc.GetString("air-alarm-ui-gases-indicator",
-                ("gas", $"{gas}"),
+                ("gas", Loc.GetString(gasName)),
                 ("color", AirAlarmWindow.ColorForThreshold(fractionGas, data.GasThresholds[gas])),
                 ("amount", $"{amount:0.####}"),
                 ("percentage", $"{(100 * fractionGas):0.##}")));
index 0d5e741d0f66c8adea04fa6c1811260c0baa81b6..7ce21fdd780d38fadd847fa85cc51aa648f09762 100644 (file)
@@ -2,6 +2,6 @@
     HorizontalExpand="True" Orientation="Vertical"
             Margin = "20 0 0 0" MinSize="160 0" >
     <Label Name="CBoundLabel" HorizontalAlignment="Center" />
-    <CheckBox Name="CBoundEnabled" HorizontalAlignment="Center" Text="{Loc 'Enable'}" Pressed="True" />
+    <CheckBox Name="CBoundEnabled" HorizontalAlignment="Center" Text="{Loc 'air-alarm-ui-widget-enable'}" Pressed="True" />
     <FloatSpinBox Name="CSpinner" />
 </BoxContainer>
index 635a70f532c5c28377f3a7aa3fc78dd92f05e24e..76fc1621abb018e59c977917e444073dd65ca6d3 100644 (file)
@@ -6,7 +6,7 @@
         <CollapsibleBody Margin="20 0 0 0">
             <BoxContainer Orientation="Vertical">
                 <BoxContainer Orientation="Horizontal">
-                    <CheckBox Name="CEnabled" Text="{Loc 'Enabled'}" />
+                    <CheckBox Name="CEnabled" Text="{Loc 'air-alarm-ui-widget-enable'}" />
                 </BoxContainer>
                 <!-- Upper row: Danger bounds -->
                 <BoxContainer Name="CDangerBounds" Orientation="Horizontal" Margin="0 0 0 2"/>
index 12eb7ffc238981d300bc9b04f764aaf990553462..d95cb5bb8cb0f8a6ff140accb08d576dfcde4179 100644 (file)
@@ -1020,7 +1020,7 @@ namespace Content.Client.Lobby.UI
 
             _loadoutWindow = new LoadoutWindow(Profile, roleLoadout, roleLoadoutProto, _playerManager.LocalSession, collection)
             {
-                Title = jobProto?.ID + "-loadout",
+                Title = Loc.GetString("loadout-window-title-loadout", ("job", $"{jobProto?.LocalizedName}")),
             };
 
             // Refresh the buttons etc.
index 469faf209d3301cad7940ddcf9876bad8b591a3b..da0b9f60d8bd6e636c6ed34d1e25a94257c1ac8a 100644 (file)
@@ -5,15 +5,15 @@
     <BoxContainer Orientation="Vertical" VerticalExpand="True" HorizontalExpand="True">
         <networkConfigurator:NetworkConfiguratorDeviceList Name="DeviceList" MinHeight="500" />
         <BoxContainer Orientation="Horizontal" HorizontalExpand="True" Margin="8 8 8 1">
-            <Button Name="Set" Text="Set" Access="Public" ToolTip="{Loc 'network-configurator-tooltip-set'}" HorizontalExpand="True" StyleClasses="ButtonSquare"/>
-            <Button Name="Add" Text="Add" Access="Public" ToolTip="{Loc 'network-configurator-tooltip-add'}" HorizontalExpand="True" StyleClasses="ButtonSquare"/>
+            <Button Name="Set" Text="{Loc 'network-configurator-text-set'}" Access="Public" ToolTip="{Loc 'network-configurator-tooltip-set'}" HorizontalExpand="True" StyleClasses="ButtonSquare"/>
+            <Button Name="Add" Text="{Loc 'network-configurator-text-add'}" Access="Public" ToolTip="{Loc 'network-configurator-tooltip-add'}" HorizontalExpand="True" StyleClasses="ButtonSquare"/>
             <!-- Edit might not be needed  -->
             <!--<Button Name="Edit" Text="Edit" Access="Public" ToolTip="{Loc 'network-configurator-tooltip-edit'}" HorizontalExpand="True" StyleClasses="ButtonSquare"/>-->
-            <Button Name="Clear" Text="Clear" Access="Public" ToolTip="{Loc 'network-configurator-tooltip-clear'}" HorizontalExpand="True"/>
+            <Button Name="Clear" Text="{Loc 'network-configurator-text-clear'}" Access="Public" ToolTip="{Loc 'network-configurator-tooltip-clear'}" HorizontalExpand="True"/>
         </BoxContainer>
         <BoxContainer Orientation="Horizontal" HorizontalExpand="True" Margin="8 0 8 8">
-            <Button Name="Copy" Text="Copy" Access="Public" ToolTip="{Loc 'network-configurator-tooltip-copy'}" HorizontalExpand="True" StyleClasses="OpenRight"/>
-            <Button Name="Show" Text="Show" Access="Public" ToggleMode="True" ToolTip="{Loc 'network-configurator-tooltip-show'}" HorizontalExpand="True" StyleClasses="ButtonSquare"/>
+            <Button Name="Copy" Text="{Loc 'network-configurator-text-copy'}" Access="Public" ToolTip="{Loc 'network-configurator-tooltip-copy'}" HorizontalExpand="True" StyleClasses="OpenRight"/>
+            <Button Name="Show" Text="{Loc 'network-configurator-text-show'}" Access="Public" ToggleMode="True" ToolTip="{Loc 'network-configurator-tooltip-show'}" HorizontalExpand="True" StyleClasses="ButtonSquare"/>
         </BoxContainer>
         <Label Name="Count" StyleClasses="LabelSubText" HorizontalAlignment="Right" Margin="0 0 12 8"/>
     </BoxContainer>
index 2239fd72b1bfaa7f8f825b6207d718fc3a5f0b59..d691e854ea2912ac6799bfae3d9012767890cc58 100644 (file)
@@ -209,22 +209,8 @@ namespace Content.Shared.Wires
     {
         public static string Name(this WireColor color)
         {
-            return Loc.GetString(color switch
-            {
-                WireColor.Red => "Red",
-                WireColor.Blue => "Blue",
-                WireColor.Green => "Green",
-                WireColor.Orange => "Orange",
-                WireColor.Brown => "Brown",
-                WireColor.Gold => "Gold",
-                WireColor.Gray => "Gray",
-                WireColor.Cyan => "Cyan",
-                WireColor.Navy => "Navy",
-                WireColor.Purple => "Purple",
-                WireColor.Pink => "Pink",
-                WireColor.Fuchsia => "Fuchsia",
-                _ => throw new InvalidOperationException()
-            });
+            var colorName = Enum.GetName(color) ?? throw new InvalidOperationException();
+            return Loc.GetString($"wire-name-color-{colorName.ToLower()}");
         }
 
         public static Color ColorValue(this WireColor color)
@@ -251,30 +237,30 @@ namespace Content.Shared.Wires
         {
             return Loc.GetString(letter switch
             {
-                WireLetter.α => "Alpha",
-                WireLetter.β => "Beta",
-                WireLetter.γ => "Gamma",
-                WireLetter.δ => "Delta",
-                WireLetter.ε => "Epsilon",
-                WireLetter.ζ => "Zeta",
-                WireLetter.η => "Eta",
-                WireLetter.θ => "Theta",
-                WireLetter.ι => "Iota",
-                WireLetter.κ => "Kappa",
-                WireLetter.λ => "Lambda",
-                WireLetter.μ => "Mu",
-                WireLetter.ν => "Nu",
-                WireLetter.ξ => "Xi",
-                WireLetter.ο => "Omicron",
-                WireLetter.π => "Pi",
-                WireLetter.ρ => "Rho",
-                WireLetter.σ => "Sigma",
-                WireLetter.τ => "Tau",
-                WireLetter.υ => "Upsilon",
-                WireLetter.φ => "Phi",
-                WireLetter.χ => "Chi",
-                WireLetter.ψ => "Psi",
-                WireLetter.ω => "Omega",
+                WireLetter.α => "wire-letter-name-alpha",
+                WireLetter.β => "wire-letter-name-beta",
+                WireLetter.γ => "wire-letter-name-gamma",
+                WireLetter.δ => "wire-letter-name-delta",
+                WireLetter.ε => "wire-letter-name-epsilon",
+                WireLetter.ζ => "wire-letter-name-zeta ",
+                WireLetter.η => "wire-letter-name-eta",
+                WireLetter.θ => "wire-letter-name-theta",
+                WireLetter.ι => "wire-letter-name-iota",
+                WireLetter.κ => "wire-letter-name-kappa",
+                WireLetter.λ => "wire-letter-name-lambda",
+                WireLetter.μ => "wire-letter-name-mu",
+                WireLetter.ν => "wire-letter-name-nu",
+                WireLetter.ξ => "wire-letter-name-xi",
+                WireLetter.ο => "wire-letter-name-omicron",
+                WireLetter.π => "wire-letter-name-pi",
+                WireLetter.ρ => "wire-letter-name-rho",
+                WireLetter.σ => "wire-letter-name-sigma",
+                WireLetter.τ => "wire-letter-name-tau",
+                WireLetter.υ => "wire-letter-name-upsilon",
+                WireLetter.φ => "wire-letter-name-phi",
+                WireLetter.χ => "wire-letter-name-chi",
+                WireLetter.ψ => "wire-letter-name-psi",
+                WireLetter.ω => "wire-letter-name-omega",
                 _ => throw new InvalidOperationException()
             });
         }
index 28cb58242eb91e5d54e9b3aa9040089d57cf4c5f..9d4020baccd71d86f912b2782b3c4be0524de3dc 100644 (file)
@@ -47,6 +47,18 @@ air-alarm-ui-mode-fill = Fill
 air-alarm-ui-mode-panic = Panic
 air-alarm-ui-mode-none = None
 
+
+air-alarm-ui-pump-direction-siphoning = Siphoning
+air-alarm-ui-pump-direction-scrubbing = Scrubbing
+air-alarm-ui-pump-direction-releasing = Releasing
+
+air-alarm-ui-pressure-bound-nobound = No Bound
+air-alarm-ui-pressure-bound-internalbound = Internal Bound
+air-alarm-ui-pressure-bound-externalbound = External Bound
+air-alarm-ui-pressure-bound-both = Both
+
+air-alarm-ui-widget-gas-filters = Gas Filters
+
 ## Widgets
 
 ### General
index 8e0724b41e600c7bf390516759442e85cab62d9a..092a3fb0fae371fb464d514e94515fdbf69dbe4e 100644 (file)
@@ -26,6 +26,12 @@ network-configurator-title-device-configuration = Device Configuration
 network-configurator-ui-clear-button = Clear
 network-configurator-ui-count-label = {$count} Devices
 
+network-configurator-text-set = Set
+network-configurator-text-add = Add
+network-configurator-text-clear = Clear
+network-configurator-text-copy = Copy
+network-configurator-text-show = Show
+
 # tooltips
 network-configurator-tooltip-set = Sets targets device list
 network-configurator-tooltip-add = Adds to targets device list
index 6e1f074e0f6c6fee3a5c2a9746f2a8b9a5670547..29f988ca7160ad015536c4dee56e475f47cc6695 100644 (file)
@@ -1,2 +1,3 @@
 loadout-window = Loadout
 loadout-none = None
+loadout-window-title-loadout = { $job } loadout
index cd8867f1352f417b3437586e8482aab4a72b5ba5..ffe9741c28d09eb7ff6f2a015016b89878b92dfa 100644 (file)
@@ -1,2 +1,43 @@
 wires-panel-component-on-examine-open = The [color=lightgray]maintenance panel[/color] is [color=red]open[/color].
 wires-panel-component-on-examine-closed = The [color=lightgray]maintenance panel[/color] is [color=darkgreen]closed[/color].
+
+# wire colors
+
+wire-name-color-red = Red
+wire-name-color-blue = Blue
+wire-name-color-green = Green
+wire-name-color-orange = Orange
+wire-name-color-brown = Brown
+wire-name-color-gold = Gold
+wire-name-color-gray = Gray
+wire-name-color-cyan = Cyan
+wire-name-color-navy = Navy
+wire-name-color-purple = Purple
+wire-name-color-pink = Pink
+wire-name-color-fuchsia = Fuchsia
+
+# letter names
+wire-letter-name-alpha = Alpha
+wire-letter-name-beta = Beta
+wire-letter-name-gamma = Gamma
+wire-letter-name-delta = Delta
+wire-letter-name-epsilon = Epsilon
+wire-letter-name-zeta = Zeta
+wire-letter-name-eta = Eta
+wire-letter-name-theta = Theta
+wire-letter-name-iota = Iota
+wire-letter-name-kappa = Kappa
+wire-letter-name-lambda = Lambda
+wire-letter-name-mu = Mu
+wire-letter-name-nu = Nu
+wire-letter-name-xi = Xi
+wire-letter-name-omicron = Omicron
+wire-letter-name-pi = Pi
+wire-letter-name-rho = Rho
+wire-letter-name-sigma = Sigma
+wire-letter-name-tau = Tau
+wire-letter-name-upsilon = Upsilon
+wire-letter-name-phi = Phi
+wire-letter-name-chi = Chi
+wire-letter-name-psi = Psi
+wire-letter-name-omega = Omega