diff --git a/osu.Desktop/Security/ElevatedPrivilegesChecker.cs b/osu.Desktop/Security/ElevatedPrivilegesChecker.cs index 4b6ebc9b56..1ac0a8153a 100644 --- a/osu.Desktop/Security/ElevatedPrivilegesChecker.cs +++ b/osu.Desktop/Security/ElevatedPrivilegesChecker.cs @@ -7,6 +7,7 @@ using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Sprites; using osu.Game.Graphics; +using osu.Game.Localisation; using osu.Game.Overlays; using osu.Game.Overlays.Notifications; @@ -32,7 +33,7 @@ namespace osu.Desktop.Security { public ElevatedPrivilegesNotification() { - Text = $"Running osu! as {(RuntimeInfo.IsUnix ? "root" : "administrator")} does not improve performance, may break integrations and poses a security risk. Please run the game as a normal user."; + Text = NotificationsStrings.ElevatedPrivileges(RuntimeInfo.IsUnix ? "root" : "Administrator"); } [BackgroundDependencyLoader] diff --git a/osu.Game/Database/LegacyBeatmapExporter.cs b/osu.Game/Database/LegacyBeatmapExporter.cs index 7587c2332f..0ddce16355 100644 --- a/osu.Game/Database/LegacyBeatmapExporter.cs +++ b/osu.Game/Database/LegacyBeatmapExporter.cs @@ -13,6 +13,7 @@ using osu.Game.Beatmaps.Formats; using osu.Game.Beatmaps.Timing; using osu.Game.Extensions; using osu.Game.IO; +using osu.Game.Localisation; using osu.Game.Overlays.Notifications; using osu.Game.Rulesets.Objects; using osu.Game.Rulesets.Objects.Types; @@ -198,7 +199,7 @@ namespace osu.Game.Database ProgressNotification notification = new ProgressNotification { State = ProgressNotificationState.Active, - Text = $"Exporting {itemFilename}...", + Text = NotificationsStrings.FileExportOngoing(itemFilename), }; PostNotification?.Invoke(notification); @@ -225,7 +226,7 @@ namespace osu.Game.Database throw; } - notification.CompletionText = $"Exported {itemFilename}! Click to view."; + notification.CompletionText = NotificationsStrings.FileExportFinished(itemFilename); notification.CompletionClickAction = () => ExportStorage.PresentFileExternally(filename); notification.State = ProgressNotificationState.Completed; }); diff --git a/osu.Game/Database/LegacyExporter.cs b/osu.Game/Database/LegacyExporter.cs index cc0fd8f8a2..eec6bf9341 100644 --- a/osu.Game/Database/LegacyExporter.cs +++ b/osu.Game/Database/LegacyExporter.cs @@ -10,6 +10,7 @@ using System.Threading.Tasks; using osu.Framework.Platform; using osu.Game.Extensions; using osu.Game.IO; +using osu.Game.Localisation; using osu.Game.Overlays.Notifications; using osu.Game.Utils; using Realms; @@ -83,7 +84,7 @@ namespace osu.Game.Database ProgressNotification notification = new ProgressNotification { State = ProgressNotificationState.Active, - Text = $"Exporting {itemFilename}...", + Text = NotificationsStrings.FileExportOngoing(itemFilename), }; PostNotification?.Invoke(notification); @@ -106,7 +107,7 @@ namespace osu.Game.Database throw; } - notification.CompletionText = $"Exported {itemFilename}! Click to view."; + notification.CompletionText = NotificationsStrings.FileExportFinished(itemFilename); notification.CompletionClickAction = () => ExportStorage.PresentFileExternally(filename); notification.State = ProgressNotificationState.Completed; } diff --git a/osu.Game/Graphics/ScreenshotManager.cs b/osu.Game/Graphics/ScreenshotManager.cs index a085558b3a..28795b5799 100644 --- a/osu.Game/Graphics/ScreenshotManager.cs +++ b/osu.Game/Graphics/ScreenshotManager.cs @@ -17,6 +17,7 @@ using osu.Framework.Platform; using osu.Framework.Threading; using osu.Game.Configuration; using osu.Game.Input.Bindings; +using osu.Game.Localisation; using osu.Game.Online.Multiplayer; using osu.Game.Overlays; using osu.Game.Overlays.Notifications; @@ -169,7 +170,7 @@ namespace osu.Game.Graphics notificationOverlay.Post(new SimpleNotification { - Text = $"Screenshot {filename} saved!", + Text = NotificationsStrings.ScreenshotSaved(filename), Activated = () => { storage.PresentFileExternally(filename); diff --git a/osu.Game/Localisation/NotificationsStrings.cs b/osu.Game/Localisation/NotificationsStrings.cs index 1d6b69a007..835dfef08e 100644 --- a/osu.Game/Localisation/NotificationsStrings.cs +++ b/osu.Game/Localisation/NotificationsStrings.cs @@ -210,6 +210,56 @@ Click to see what's new!", version); /// public static LocalisableString ActionInterruptedByDialog => new TranslatableString(getKey(@"action_interrupted_by_dialog"), @"An action was interrupted due to a dialog being displayed."); + /// + /// "Exporting {0}..." + /// + public static LocalisableString FileExportOngoing(string filename) => new TranslatableString(getKey(@"file_export_ongoing"), @"Exporting {0}...", filename); + + /// + /// "Exported {0}! Click to view." + /// + public static LocalisableString FileExportFinished(string filename) => new TranslatableString(getKey(@"file_export_finished"), @"Exported {0}! Click to view.", filename); + + /// + /// "Exporting logs..." + /// + public static LocalisableString LogsExportOngoing => new TranslatableString(getKey(@"logs_export_ongoing"), @"Exporting logs..."); + + /// + /// "Exported logs! Click to view." + /// + public static LocalisableString LogsExportFinished => new TranslatableString(getKey(@"logs_export_finished"), @"Exported logs! Click to view."); + + /// + /// "Running osu! as {0} does not improve performance, may break integrations and poses a security risk. Please run the game as a normal user." + /// + public static LocalisableString ElevatedPrivileges(LocalisableString user) => new TranslatableString(getKey(@"elevated_privileges"), @"Running osu! as {0} does not improve performance, may break integrations and poses a security risk. Please run the game as a normal user.", user); + + /// + /// "Screenshot {0} saved!" + /// + public static LocalisableString ScreenshotSaved(string filename) => new TranslatableString(getKey(@"screenshot_saved"), @"Screenshot {0} saved!", filename); + + /// + /// "The multiplayer server will be right back..." + /// + public static LocalisableString MultiplayerServerShuttingDownImmediately => new TranslatableString(getKey(@"multiplayer_server_shutting_down_immediately"), @"The multiplayer server will be right back..."); + + /// + /// "The multiplayer server is restarting in {0}." + /// + public static LocalisableString MultiplayerServerShuttingDownRemaining(string remainingTime) => new TranslatableString(getKey(@"multiplayer_server_shutting_down_remaining"), @"The multiplayer server is restarting in {0}.", remainingTime); + + /// + /// "Created new collection "{0}" with {1} beatmaps." + /// + public static LocalisableString CollectionCreated(string name, int beatmapsCount) => new TranslatableString(getKey(@"collection_created"), @"Created new collection ""{0}"" with {1} beatmaps.", name, beatmapsCount); + + /// + /// "Added {0} beatmaps to collection "{1}"." + /// + public static LocalisableString CollectionBeatmapsAdded(string name, int beatmapsCount) => new TranslatableString(getKey(@"collection_beatmaps_added"), @"Added {0} beatmaps to collection ""{1}"".", beatmapsCount, name); + private static string getKey(string key) => $@"{prefix}:{key}"; } } diff --git a/osu.Game/Online/Multiplayer/ServerShutdownNotification.cs b/osu.Game/Online/Multiplayer/ServerShutdownNotification.cs index 1de18e44a7..5a6367b06b 100644 --- a/osu.Game/Online/Multiplayer/ServerShutdownNotification.cs +++ b/osu.Game/Online/Multiplayer/ServerShutdownNotification.cs @@ -5,6 +5,7 @@ using System; using Humanizer.Localisation; using osu.Framework.Allocation; using osu.Framework.Threading; +using osu.Game.Localisation; using osu.Game.Overlays.Notifications; using osu.Game.Utils; @@ -53,10 +54,10 @@ namespace osu.Game.Online.Multiplayer if (remaining.TotalSeconds <= 5) { updateDelegate?.Cancel(); - Text = "The multiplayer server will be right back..."; + Text = NotificationsStrings.MultiplayerServerShuttingDownImmediately; } else - Text = $"The multiplayer server is restarting in {HumanizerUtils.Humanize(remaining, precision: 3, minUnit: TimeUnit.Second)}."; + Text = NotificationsStrings.MultiplayerServerShuttingDownRemaining(HumanizerUtils.Humanize(remaining, precision: 3, minUnit: TimeUnit.Second)); } } } diff --git a/osu.Game/Overlays/Settings/Sections/General/QuickActionSettings.cs b/osu.Game/Overlays/Settings/Sections/General/QuickActionSettings.cs index b6b78a6d00..d01a63f87a 100644 --- a/osu.Game/Overlays/Settings/Sections/General/QuickActionSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/General/QuickActionSettings.cs @@ -84,7 +84,7 @@ namespace osu.Game.Overlays.Settings.Sections.General ProgressNotification notification = new ProgressNotification { State = ProgressNotificationState.Active, - Text = "Exporting logs...", + Text = NotificationsStrings.LogsExportOngoing, }; notifications?.Post(notification); @@ -116,7 +116,7 @@ namespace osu.Game.Overlays.Settings.Sections.General throw; } - notification.CompletionText = "Exported logs! Click to view."; + notification.CompletionText = NotificationsStrings.LogsExportFinished; notification.CompletionClickAction = () => exportStorage.PresentFileExternally(archive_filename); notification.State = ProgressNotificationState.Completed; diff --git a/osu.Game/Screens/OnlinePlay/Playlists/AddPlaylistToCollectionButton.cs b/osu.Game/Screens/OnlinePlay/Playlists/AddPlaylistToCollectionButton.cs index 47629981f1..5a68781397 100644 --- a/osu.Game/Screens/OnlinePlay/Playlists/AddPlaylistToCollectionButton.cs +++ b/osu.Game/Screens/OnlinePlay/Playlists/AddPlaylistToCollectionButton.cs @@ -10,6 +10,7 @@ using osu.Game.Beatmaps; using osu.Game.Collections; using osu.Game.Database; using osu.Game.Graphics.UserInterfaceV2; +using osu.Game.Localisation; using osu.Game.Online.Rooms; using osu.Game.Overlays; using osu.Game.Overlays.Notifications; @@ -69,10 +70,14 @@ namespace osu.Game.Screens.OnlinePlay.Playlists countAfter = c.BeatmapMD5Hashes.Count; }).ContinueWith(_ => Schedule(() => { + LocalisableString message; + if (countBefore == 0) - notifications?.Post(new SimpleNotification { Text = $"Created new collection \"{room.Name}\" with {countAfter} beatmaps." }); + message = NotificationsStrings.CollectionCreated(room.Name, countAfter); else - notifications?.Post(new SimpleNotification { Text = $"Added {countAfter - countBefore} beatmaps to collection \"{room.Name}\"." }); + message = NotificationsStrings.CollectionBeatmapsAdded(room.Name, countAfter - countBefore); + + notifications?.Post(new SimpleNotification { Text = message }); })); }; }