Skip to content

Commit

Permalink
Merge pull request #24064 from bastianpedersen/localise-common-game-n…
Browse files Browse the repository at this point in the history
…otifications

Localise common game notifications
  • Loading branch information
bdach authored Jun 27, 2023
2 parents eb6bdb5 + 62dcd51 commit eb82bd3
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 5 deletions.
25 changes: 25 additions & 0 deletions osu.Game/Localisation/NotificationsStrings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,31 @@ public static class NotificationsStrings
/// </summary>
public static LocalisableString ScoreOverlayDisabled(LocalisableString arg0) => new TranslatableString(getKey(@"score_overlay_disabled"), @"The score overlay is currently disabled. You can toggle this by pressing {0}.", arg0);

/// <summary>
/// "The URL {0} has an unsupported or dangerous protocol and will not be opened."
/// </summary>
public static LocalisableString UnsupportedOrDangerousUrlProtocol(string url) => new TranslatableString(getKey(@"unsupported_or_dangerous_url_protocol"), @"The URL {0} has an unsupported or dangerous protocol and will not be opened.", url);

/// <summary>
/// "Subsequent messages have been logged. Click to view log files."
/// </summary>
public static LocalisableString SubsequentMessagesLogged => new TranslatableString(getKey(@"subsequent_messages_logged"), @"Subsequent messages have been logged. Click to view log files.");

/// <summary>
/// "Disabling tablet support due to error: &quot;{0}&quot;"
/// </summary>
public static LocalisableString TabletSupportDisabledDueToError(string message) => new TranslatableString(getKey(@"tablet_support_disabled_due_to_error"), @"Disabling tablet support due to error: ""{0}""", message);

/// <summary>
/// "Encountered tablet warning, your tablet may not function correctly. Click here for a list of all tablets supported."
/// </summary>
public static LocalisableString EncounteredTabletWarning => new TranslatableString(getKey(@"encountered_tablet_warning"), @"Encountered tablet warning, your tablet may not function correctly. Click here for a list of all tablets supported.");

/// <summary>
/// "This link type is not yet supported!"
/// </summary>
public static LocalisableString LinkTypeNotSupported => new TranslatableString(getKey(@"unsupported_link_type"), @"This link type is not yet supported!");

private static string getKey(string key) => $@"{prefix}:{key}";
}
}
10 changes: 5 additions & 5 deletions osu.Game/OsuGame.cs
Original file line number Diff line number Diff line change
Expand Up @@ -435,7 +435,7 @@ public void HandleLink(LinkDetails link) => Schedule(() =>
case LinkAction.Spectate:
waitForReady(() => Notifications, _ => Notifications.Post(new SimpleNotification
{
Text = @"This link type is not yet supported!",
Text = NotificationsStrings.LinkTypeNotSupported,
Icon = FontAwesome.Solid.LifeRing,
}));
break;
Expand Down Expand Up @@ -477,7 +477,7 @@ public void OpenUrlExternally(string url, bool bypassExternalUrlWarning = false)
{
Notifications.Post(new SimpleErrorNotification
{
Text = $"The URL {url} has an unsupported or dangerous protocol and will not be opened.",
Text = NotificationsStrings.UnsupportedOrDangerousUrlProtocol(url),
});
return;
Expand Down Expand Up @@ -1147,7 +1147,7 @@ private void forwardGeneralLogsToNotifications()
Schedule(() => Notifications.Post(new SimpleNotification
{
Icon = FontAwesome.Solid.EllipsisH,
Text = "Subsequent messages have been logged. Click to view log files.",
Text = NotificationsStrings.SubsequentMessagesLogged,
Activated = () =>
{
Storage.GetStorageForDirectory(@"logs").PresentFileExternally(logFile);
Expand Down Expand Up @@ -1179,7 +1179,7 @@ private void forwardTabletLogsToNotifications()
{
Notifications.Post(new SimpleNotification
{
Text = $"Disabling tablet support due to error: \"{message}\"",
Text = NotificationsStrings.TabletSupportDisabledDueToError(message),
Icon = FontAwesome.Solid.PenSquare,
IconColour = Colours.RedDark,
});
Expand All @@ -1196,7 +1196,7 @@ private void forwardTabletLogsToNotifications()
{
Schedule(() => Notifications.Post(new SimpleNotification
{
Text = @"Encountered tablet warning, your tablet may not function correctly. Click here for a list of all tablets supported.",
Text = NotificationsStrings.EncounteredTabletWarning,
Icon = FontAwesome.Solid.PenSquare,
IconColour = Colours.YellowDark,
Activated = () =>
Expand Down

0 comments on commit eb82bd3

Please sign in to comment.