localization support to air alarms, wire panels and more (#39307)
* 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
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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">
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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.##}")));
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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"/>
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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()
|
||||
});
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -1,2 +1,3 @@
|
||||
loadout-window = Loadout
|
||||
loadout-none = None
|
||||
loadout-window-title-loadout = { $job } loadout
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user