1
0
mirror of https://github.com/ppy/osu.git synced 2025-02-15 23:42:55 +08:00

Add full localisation of import beatmaps screen

This commit is contained in:
Dean Herbert 2022-05-17 17:58:24 +09:00
parent f4e0ad8c4c
commit bf00b062ad
3 changed files with 66 additions and 20 deletions

View File

@ -0,0 +1,56 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using osu.Framework.Localisation;
namespace osu.Game.Localisation
{
public static class FirstRunOverlayImportFromStableScreenStrings
{
private const string prefix = @"osu.Game.Resources.Localisation.ScreenImportFromStable";
/// <summary>
/// "Import"
/// </summary>
public static LocalisableString Header => new TranslatableString(getKey(@"header"), @"Import");
/// <summary>
/// "If you have an installation of a previous osu! version, you can choose to migrate your existing content. Note that this will create a copy, and not affect your existing installation."
/// </summary>
public static LocalisableString Description => new TranslatableString(getKey(@"description"),
@"If you have an installation of a previous osu! version, you can choose to migrate your existing content. Note that this will create a copy, and not affect your existing installation.");
/// <summary>
/// "previous osu! install"
/// </summary>
public static LocalisableString LocateDirectoryLabel => new TranslatableString(getKey(@"locate_directory_label"), @"previous osu! install");
/// <summary>
/// "Click to locate a previous osu! install"
/// </summary>
public static LocalisableString LocateDirectoryPlaceholder => new TranslatableString(getKey(@"locate_directory_placeholder"), @"Click to locate a previous osu! install");
/// <summary>
/// "Import content from previous version"
/// </summary>
public static LocalisableString ImportButton => new TranslatableString(getKey(@"import_button"), @"Import content from previous version");
/// <summary>
/// "Your import will continue in the background. Check on its progress in the notifications sidebar!"
/// </summary>
public static LocalisableString ImportInProgress =>
new TranslatableString(getKey(@"import_in_progress"), @"Your import will continue in the background. Check on its progress in the notifications sidebar!");
/// <summary>
/// "calculating..."
/// </summary>
public static LocalisableString Calculating => new TranslatableString(getKey(@"calculating"), @"calculating...");
/// <summary>
/// "{0} items"
/// </summary>
public static LocalisableString Items(int arg0) => new TranslatableString(getKey(@"items"), @"{0} item(s)", arg0);
private static string getKey(string key) => $@"{prefix}:{key}";
}
}

View File

@ -74,16 +74,6 @@ We recommend you give the new defaults a try, but if you'd like to have things f
/// </summary> /// </summary>
public static LocalisableString ClassicDefaults => new TranslatableString(getKey(@"classic_defaults"), @"Classic defaults"); public static LocalisableString ClassicDefaults => new TranslatableString(getKey(@"classic_defaults"), @"Classic defaults");
/// <summary>
/// "Welcome"
/// </summary>
public static LocalisableString ImportTitle => new TranslatableString(getKey(@"import_title"), @"Import");
/// <summary>
/// "Import content from previous version"
/// </summary>
public static LocalisableString ImportContentFromPreviousVersion => new TranslatableString(getKey(@"import_content_from_previous_version"), @"Import content from previous version");
private static string getKey(string key) => $@"{prefix}:{key}"; private static string getKey(string key) => $@"{prefix}:{key}";
} }
} }

View File

@ -27,7 +27,7 @@ using osuTK;
namespace osu.Game.Overlays.FirstRunSetup namespace osu.Game.Overlays.FirstRunSetup
{ {
[LocalisableDescription(typeof(FirstRunSetupOverlayStrings), nameof(FirstRunSetupOverlayStrings.ImportTitle))] [LocalisableDescription(typeof(FirstRunOverlayImportFromStableScreenStrings), nameof(FirstRunOverlayImportFromStableScreenStrings.Header))]
public class ScreenImportFromStable : FirstRunSetupScreen public class ScreenImportFromStable : FirstRunSetupScreen
{ {
private static readonly Vector2 button_size = new Vector2(400, 50); private static readonly Vector2 button_size = new Vector2(400, 50);
@ -51,15 +51,14 @@ namespace osu.Game.Overlays.FirstRunSetup
new OsuTextFlowContainer(cp => cp.Font = OsuFont.Default.With(size: CONTENT_FONT_SIZE)) new OsuTextFlowContainer(cp => cp.Font = OsuFont.Default.With(size: CONTENT_FONT_SIZE))
{ {
Colour = OverlayColourProvider.Content1, Colour = OverlayColourProvider.Content1,
Text = Text = FirstRunOverlayImportFromStableScreenStrings.Description,
"If you have an installation of a previous osu! version, you can choose to migrate your existing content. Note that this will create a copy, and not affect your existing installation.",
RelativeSizeAxes = Axes.X, RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y AutoSizeAxes = Axes.Y
}, },
stableLocatorTextBox = new StableLocatorLabelledTextBox stableLocatorTextBox = new StableLocatorLabelledTextBox
{ {
Label = "previous osu! install", Label = FirstRunOverlayImportFromStableScreenStrings.LocateDirectoryLabel,
PlaceholderText = "Click to locate a previous osu! install" PlaceholderText = FirstRunOverlayImportFromStableScreenStrings.LocateDirectoryPlaceholder
}, },
new ImportCheckbox("Beatmaps", StableContent.Beatmaps), new ImportCheckbox("Beatmaps", StableContent.Beatmaps),
new ImportCheckbox("Scores", StableContent.Scores), new ImportCheckbox("Scores", StableContent.Scores),
@ -70,14 +69,13 @@ namespace osu.Game.Overlays.FirstRunSetup
Size = button_size, Size = button_size,
Anchor = Anchor.TopCentre, Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre, Origin = Anchor.TopCentre,
Text = FirstRunSetupOverlayStrings.ImportContentFromPreviousVersion, Text = FirstRunOverlayImportFromStableScreenStrings.ImportButton,
Action = runImport Action = runImport
}, },
progressText = new OsuTextFlowContainer(cp => cp.Font = OsuFont.Default.With(size: CONTENT_FONT_SIZE)) progressText = new OsuTextFlowContainer(cp => cp.Font = OsuFont.Default.With(size: CONTENT_FONT_SIZE))
{ {
Colour = OverlayColourProvider.Content1, Colour = OverlayColourProvider.Content1,
Text = Text = FirstRunOverlayImportFromStableScreenStrings.ImportInProgress,
"Your import will continue in the background. Check on its progress in the notifications sidebar!",
RelativeSizeAxes = Axes.X, RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y, AutoSizeAxes = Axes.Y,
Alpha = 0, Alpha = 0,
@ -168,7 +166,7 @@ namespace osu.Game.Overlays.FirstRunSetup
public void UpdateCount() public void UpdateCount()
{ {
LabelText = LocalisableString.Interpolate($"{title} (calculating...)"); LabelText = LocalisableString.Interpolate($"{title} ({FirstRunOverlayImportFromStableScreenStrings.Calculating})");
countUpdateCancellation?.Cancel(); countUpdateCancellation?.Cancel();
countUpdateCancellation = new CancellationTokenSource(); countUpdateCancellation = new CancellationTokenSource();
@ -178,7 +176,9 @@ namespace osu.Game.Overlays.FirstRunSetup
if (task.IsCanceled) if (task.IsCanceled)
return; return;
LabelText = LocalisableString.Interpolate($"{title} ({task.GetResultSafely()} items)"); int count = task.GetResultSafely();
LabelText = LocalisableString.Interpolate($"{title} ({FirstRunOverlayImportFromStableScreenStrings.Items(count)})");
})); }));
} }
} }