mirror of
https://github.com/SK-la/Ez2Lazer.git
synced 2026-03-15 03:20:27 +00:00
Add localisation support for some more notifications (#36353)
Co-authored-by: Dean Herbert <pe@ppy.sh>
This commit is contained in:
@@ -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]
|
||||
|
||||
@@ -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;
|
||||
});
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -210,6 +210,56 @@ Click to see what's new!", version);
|
||||
/// </summary>
|
||||
public static LocalisableString ActionInterruptedByDialog => new TranslatableString(getKey(@"action_interrupted_by_dialog"), @"An action was interrupted due to a dialog being displayed.");
|
||||
|
||||
/// <summary>
|
||||
/// "Exporting {0}..."
|
||||
/// </summary>
|
||||
public static LocalisableString FileExportOngoing(string filename) => new TranslatableString(getKey(@"file_export_ongoing"), @"Exporting {0}...", filename);
|
||||
|
||||
/// <summary>
|
||||
/// "Exported {0}! Click to view."
|
||||
/// </summary>
|
||||
public static LocalisableString FileExportFinished(string filename) => new TranslatableString(getKey(@"file_export_finished"), @"Exported {0}! Click to view.", filename);
|
||||
|
||||
/// <summary>
|
||||
/// "Exporting logs..."
|
||||
/// </summary>
|
||||
public static LocalisableString LogsExportOngoing => new TranslatableString(getKey(@"logs_export_ongoing"), @"Exporting logs...");
|
||||
|
||||
/// <summary>
|
||||
/// "Exported logs! Click to view."
|
||||
/// </summary>
|
||||
public static LocalisableString LogsExportFinished => new TranslatableString(getKey(@"logs_export_finished"), @"Exported logs! Click to view.");
|
||||
|
||||
/// <summary>
|
||||
/// "Running osu! as {0} does not improve performance, may break integrations and poses a security risk. Please run the game as a normal user."
|
||||
/// </summary>
|
||||
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);
|
||||
|
||||
/// <summary>
|
||||
/// "Screenshot {0} saved!"
|
||||
/// </summary>
|
||||
public static LocalisableString ScreenshotSaved(string filename) => new TranslatableString(getKey(@"screenshot_saved"), @"Screenshot {0} saved!", filename);
|
||||
|
||||
/// <summary>
|
||||
/// "The multiplayer server will be right back..."
|
||||
/// </summary>
|
||||
public static LocalisableString MultiplayerServerShuttingDownImmediately => new TranslatableString(getKey(@"multiplayer_server_shutting_down_immediately"), @"The multiplayer server will be right back...");
|
||||
|
||||
/// <summary>
|
||||
/// "The multiplayer server is restarting in {0}."
|
||||
/// </summary>
|
||||
public static LocalisableString MultiplayerServerShuttingDownRemaining(string remainingTime) => new TranslatableString(getKey(@"multiplayer_server_shutting_down_remaining"), @"The multiplayer server is restarting in {0}.", remainingTime);
|
||||
|
||||
/// <summary>
|
||||
/// "Created new collection "{0}" with {1} beatmaps."
|
||||
/// </summary>
|
||||
public static LocalisableString CollectionCreated(string name, int beatmapsCount) => new TranslatableString(getKey(@"collection_created"), @"Created new collection ""{0}"" with {1} beatmaps.", name, beatmapsCount);
|
||||
|
||||
/// <summary>
|
||||
/// "Added {0} beatmaps to collection "{1}"."
|
||||
/// </summary>
|
||||
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}";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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 });
|
||||
}));
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user