Skip to content

Commit

Permalink
Аnnouncement sender localization (#29907)
Browse files Browse the repository at this point in the history
  • Loading branch information
chavonadelal authored Jul 11, 2024
1 parent 03f0257 commit 9a17154
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Content.Server/Chat/Systems/AnnounceOnSpawnSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public override void Initialize()
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);
}
}
8 changes: 6 additions & 2 deletions Content.Server/Chat/Systems/ChatSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -319,12 +319,14 @@ public void TrySendInGameOOCMessage(
/// <param name="colorOverride">Optional color for the announcement message</param>
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)
Expand All @@ -345,11 +347,13 @@ public void DispatchGlobalAnnouncement(
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);

Expand Down
1 change: 1 addition & 0 deletions Resources/Locale/en-US/chat/managers/chat-manager.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down

0 comments on commit 9a17154

Please sign in to comment.