From e842df84fadf3931a3798ebb3d8b9a73c87a0492 Mon Sep 17 00:00:00 2001 From: NIXC <16856738+NIXC@users.noreply.github.com> Date: Wed, 31 Mar 2021 07:29:57 -0600 Subject: [PATCH] Allow ownerless ids to show in pda (#3693) * Allow ownerless ids to show in pda * use new localization, and null coalesce * Adjust localization naming --- .../Components/PDA/PDABoundUserInterface.cs | 18 +++++++++--------- .../Locale/en-US/components/pda-component.ftl | 11 +++++++++++ 2 files changed, 20 insertions(+), 9 deletions(-) create mode 100644 Resources/Locale/en-US/components/pda-component.ftl diff --git a/Content.Client/GameObjects/Components/PDA/PDABoundUserInterface.cs b/Content.Client/GameObjects/Components/PDA/PDABoundUserInterface.cs index b09dd20018..b1ede0a33f 100644 --- a/Content.Client/GameObjects/Components/PDA/PDABoundUserInterface.cs +++ b/Content.Client/GameObjects/Components/PDA/PDABoundUserInterface.cs @@ -102,23 +102,23 @@ namespace Content.Client.GameObjects.Components.PDA if (msg.PDAOwnerInfo.ActualOwnerName != null) { - _menu.PDAOwnerLabel.SetMarkup(Loc.GetString("Owner: [color=white]{0}[/color]", - msg.PDAOwnerInfo.ActualOwnerName)); + _menu.PDAOwnerLabel.SetMarkup(Loc.GetString("comp-pda-ui-owner", + ("ActualOwnerName", msg.PDAOwnerInfo.ActualOwnerName))); } - if (msg.PDAOwnerInfo.JobTitle == null || msg.PDAOwnerInfo.IdOwner == null) + + if (msg.PDAOwnerInfo.IdOwner != null || msg.PDAOwnerInfo.JobTitle != null) { - _menu.IDInfoLabel.SetMarkup(Loc.GetString("ID:")); + _menu.IDInfoLabel.SetMarkup(Loc.GetString("comp-pda-ui", + ("Owner",msg.PDAOwnerInfo.IdOwner ?? "Unknown"), + ("JobTitle",msg.PDAOwnerInfo.JobTitle ?? "Unassigned"))); } else { - _menu.IDInfoLabel.SetMarkup(Loc.GetString( - "ID: [color=white]{0}[/color], [color=yellow]{1}[/color]", - msg.PDAOwnerInfo.IdOwner, - msg.PDAOwnerInfo.JobTitle)); + _menu.IDInfoLabel.SetMarkup(Loc.GetString("comp-pda-ui-blank")); } - _menu.EjectIDButton.Visible = msg.PDAOwnerInfo.IdOwner != null; + _menu.EjectIDButton.Visible = msg.PDAOwnerInfo.IdOwner != null || msg.PDAOwnerInfo.JobTitle != null; _menu.EjectPenButton.Visible = msg.HasPen; if (msg.Account != null) diff --git a/Resources/Locale/en-US/components/pda-component.ftl b/Resources/Locale/en-US/components/pda-component.ftl new file mode 100644 index 0000000000..6c4c736c77 --- /dev/null +++ b/Resources/Locale/en-US/components/pda-component.ftl @@ -0,0 +1,11 @@ + +### UI + +# For the PDA screen +comp-pda-ui = ID: [color=white]{$Owner}[/color], [color=yellow]{$JobTitle}[/color] + +comp-pda-ui-blank = ID: + +comp-pda-ui-owner = Owner: [color=white]{$ActualOwnerName}[/color] + +