mirror of
https://github.com/ppy/osu.git
synced 2026-05-18 06:29:52 +08:00
Localise notifications in LegacyCollectionImporter
This commit is contained in:
@@ -10,6 +10,7 @@ using osu.Framework.Logging;
|
||||
using osu.Framework.Platform;
|
||||
using osu.Game.Collections;
|
||||
using osu.Game.IO.Legacy;
|
||||
using osu.Game.Localisation;
|
||||
using osu.Game.Overlays.Notifications;
|
||||
|
||||
namespace osu.Game.Database
|
||||
@@ -63,7 +64,7 @@ namespace osu.Game.Database
|
||||
var notification = new ProgressNotification
|
||||
{
|
||||
State = ProgressNotificationState.Active,
|
||||
Text = "Collections import is initialising..."
|
||||
Text = NotificationsStrings.CollectionsImportInitialising,
|
||||
};
|
||||
|
||||
PostNotification?.Invoke(notification);
|
||||
@@ -71,7 +72,7 @@ namespace osu.Game.Database
|
||||
var importedCollections = readCollections(stream, notification);
|
||||
await importCollections(importedCollections).ConfigureAwait(false);
|
||||
|
||||
notification.CompletionText = $"Imported {importedCollections.Count} collections";
|
||||
notification.CompletionText = NotificationsStrings.CollectionsImportProgress(importedCollections.Count);
|
||||
notification.State = ProgressNotificationState.Completed;
|
||||
}
|
||||
|
||||
@@ -115,7 +116,7 @@ namespace osu.Game.Database
|
||||
{
|
||||
if (notification != null)
|
||||
{
|
||||
notification.Text = "Reading collections...";
|
||||
notification.Text = NotificationsStrings.ReadingCollections;
|
||||
notification.Progress = 0;
|
||||
}
|
||||
|
||||
@@ -150,7 +151,7 @@ namespace osu.Game.Database
|
||||
|
||||
if (notification != null)
|
||||
{
|
||||
notification.Text = $"Imported {i + 1} of {collectionCount} collections";
|
||||
notification.Text = NotificationsStrings.CollectionsImportProgressTotal(i + 1, collectionCount);
|
||||
notification.Progress = (float)(i + 1) / collectionCount;
|
||||
}
|
||||
|
||||
|
||||
@@ -145,6 +145,26 @@ Click to see what's new!", version);
|
||||
/// </summary>
|
||||
public static LocalisableString FriendOffline(string info) => new TranslatableString(getKey(@"friend_offline"), @"Offline: {0}", info);
|
||||
|
||||
/// <summary>
|
||||
/// "Collections import is initialising..."
|
||||
/// </summary>
|
||||
public static LocalisableString CollectionsImportInitialising => new TranslatableString(getKey(@"collections_import_initialising"), @"Collections import is initialising...");
|
||||
|
||||
/// <summary>
|
||||
/// "Reading collections..."
|
||||
/// </summary>
|
||||
public static LocalisableString ReadingCollections => new TranslatableString(getKey(@"reading_collections"), @"Reading collections...");
|
||||
|
||||
/// <summary>
|
||||
/// "Imported {0} collections"
|
||||
/// </summary>
|
||||
public static LocalisableString CollectionsImportProgress(int count) => new TranslatableString(getKey(@"collections_import_progress"), @"Imported {0} collections", count);
|
||||
|
||||
/// <summary>
|
||||
/// "Imported {0} of {1} collections"
|
||||
/// </summary>
|
||||
public static LocalisableString CollectionsImportProgressTotal(int count, int totalCount) => new TranslatableString(getKey(@"collections_import_progress_total"), @"Imported {0} of {1} collections", count, totalCount);
|
||||
|
||||
private static string getKey(string key) => $@"{prefix}:{key}";
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user