From 9a17154d83f99da09ae42ef99bb8f3e6b09f2451 Mon Sep 17 00:00:00 2001 From: chavonadelal <156101927+chavonadelal@users.noreply.github.com> Date: Thu, 11 Jul 2024 17:02:53 +0300 Subject: [PATCH] =?utf8?q?=D0=90nnouncement=20sender=20localization=20(#29?= =?utf8?q?907)?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- Content.Server/Chat/Systems/AnnounceOnSpawnSystem.cs | 2 +- Content.Server/Chat/Systems/ChatSystem.cs | 8 ++++++-- Resources/Locale/en-US/chat/managers/chat-manager.ftl | 1 + 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/Content.Server/Chat/Systems/AnnounceOnSpawnSystem.cs b/Content.Server/Chat/Systems/AnnounceOnSpawnSystem.cs index 0f0365e56b..cc46545237 100644 --- a/Content.Server/Chat/Systems/AnnounceOnSpawnSystem.cs +++ b/Content.Server/Chat/Systems/AnnounceOnSpawnSystem.cs @@ -16,7 +16,7 @@ public sealed class AnnounceOnSpawnSystem : EntitySystem private void OnInit(EntityUid uid, AnnounceOnSpawnComponent comp, MapInitEvent args) { var message = Loc.GetString(comp.Message); - var sender = comp.Sender != null ? Loc.GetString(comp.Sender) : "Central Command"; + var sender = comp.Sender != null ? Loc.GetString(comp.Sender) : Loc.GetString("chat-manager-sender-announcement"); _chat.DispatchGlobalAnnouncement(message, sender, playSound: true, comp.Sound, comp.Color); } } diff --git a/Content.Server/Chat/Systems/ChatSystem.cs b/Content.Server/Chat/Systems/ChatSystem.cs index 55beaf1f7f..5358cdb442 100644 --- a/Content.Server/Chat/Systems/ChatSystem.cs +++ b/Content.Server/Chat/Systems/ChatSystem.cs @@ -319,12 +319,14 @@ public sealed partial class ChatSystem : SharedChatSystem /// Optional color for the announcement message public void DispatchGlobalAnnouncement( string message, - string sender = "Central Command", + string? sender = null, bool playSound = true, SoundSpecifier? announcementSound = null, Color? colorOverride = null ) { + sender ??= Loc.GetString("chat-manager-sender-announcement"); + var wrappedMessage = Loc.GetString("chat-manager-sender-announcement-wrap-message", ("sender", sender), ("message", FormattedMessage.EscapeText(message))); _chatManager.ChatMessageToAll(ChatChannel.Radio, message, wrappedMessage, default, false, true, colorOverride); if (playSound) @@ -345,11 +347,13 @@ public sealed partial class ChatSystem : SharedChatSystem public void DispatchStationAnnouncement( EntityUid source, string message, - string sender = "Central Command", + string? sender = null, bool playDefaultSound = true, SoundSpecifier? announcementSound = null, Color? colorOverride = null) { + sender ??= Loc.GetString("chat-manager-sender-announcement"); + var wrappedMessage = Loc.GetString("chat-manager-sender-announcement-wrap-message", ("sender", sender), ("message", FormattedMessage.EscapeText(message))); var station = _stationSystem.GetOwningStation(source); diff --git a/Resources/Locale/en-US/chat/managers/chat-manager.ftl b/Resources/Locale/en-US/chat/managers/chat-manager.ftl index 38b12251be..75ff4351c1 100644 --- a/Resources/Locale/en-US/chat/managers/chat-manager.ftl +++ b/Resources/Locale/en-US/chat/managers/chat-manager.ftl @@ -19,6 +19,7 @@ chat-manager-no-such-channel = There is no channel with key '{$key}'! chat-manager-whisper-headset-on-message = You can't whisper on the radio! chat-manager-server-wrap-message = [bold]{$message}[/bold] +chat-manager-sender-announcement = Central Command chat-manager-sender-announcement-wrap-message = [font size=14][bold]{$sender} Announcement:[/font][font size=12] {$message}[/bold][/font] chat-manager-entity-say-wrap-message = [BubbleHeader][bold][Name]{$entityName}[/Name][/bold][/BubbleHeader] {$verb}, [font={$fontType} size={$fontSize}]"[BubbleContent]{$message}[/BubbleContent]"[/font] -- 2.51.2