1
0
mirror of https://github.com/ppy/osu.git synced 2026-06-13 00:14:50 +08:00

Add localisation support to NonSkinnableScreenPlaceholder & ExternalEdit screens (#37861)

- supersedes and closes https://github.com/ppy/osu/pull/37860

changes can be reviewed commit by commit

---------

Co-authored-by: Bartłomiej Dach <dach.bartlomiej@gmail.com>
This commit is contained in:
Denis Titovets
2026-06-10 08:57:03 +03:00
committed by GitHub
Unverified
parent 4b698128ae
commit 7c1e2d9ee0
5 changed files with 71 additions and 18 deletions
+35
View File
@@ -234,6 +234,41 @@ namespace osu.Game.Localisation
/// </summary>
public static LocalisableString RulesetNotSupportSaving => new TranslatableString(getKey(@"ruleset_not_support_saving"), @"Saving is not supported for this ruleset yet, sorry!");
/// <summary>
/// "Export failed!"
/// </summary>
public static LocalisableString ExportFailed => new TranslatableString(getKey(@"export_failed"), @"Export failed!");
/// <summary>
/// "Import failed!"
/// </summary>
public static LocalisableString ImportFailed => new TranslatableString(getKey(@"import_failed"), @"Import failed!");
/// <summary>
/// "Open folder"
/// </summary>
public static LocalisableString OpenFolder => new TranslatableString(getKey(@"open_folder"), @"Open folder");
/// <summary>
/// "Cleaning up..."
/// </summary>
public static LocalisableString ExternalEditCleaningUp => new TranslatableString(getKey(@"external_edit_cleaning_up"), @"Cleaning up...");
/// <summary>
/// "Exporting for edit..."
/// </summary>
public static LocalisableString ExternalEditExporting => new TranslatableString(getKey(@"external_edit_exporting"), @"Exporting for edit...");
/// <summary>
/// "Beatmap is mounted externally"
/// </summary>
public static LocalisableString BeatmapMountedExternally => new TranslatableString(getKey(@"beatmap_mounted_externally"), @"Beatmap is mounted externally");
/// <summary>
/// "Any changes made to the exported folder will be imported to the game, including file additions, modifications and deletions."
/// </summary>
public static LocalisableString ExternalEditMountedExplanation => new TranslatableString(getKey(@"external_edit_mounted_explanation"), @"Any changes made to the exported folder will be imported to the game, including file additions, modifications and deletions.");
private static string getKey(string key) => $@"{prefix}:{key}";
}
}
@@ -94,6 +94,21 @@ namespace osu.Game.Localisation
/// </summary>
public static LocalisableString CurrentWorkingLayer => new TranslatableString(getKey(@"current_working_layer"), @"Current working layer");
/// <summary>
/// "Please navigate to a skinnable screen using the scene library"
/// </summary>
public static LocalisableString NavigateToSkinnableScreen => new TranslatableString(getKey(@"navigate_to_skinnable_screen"), @"Please navigate to a skinnable screen using the scene library");
/// <summary>
/// "Return to game"
/// </summary>
public static LocalisableString ReturnToGame => new TranslatableString(getKey(@"return_to_game"), @"Return to game");
/// <summary>
/// "Skin is mounted externally"
/// </summary>
public static LocalisableString SkinMountedExternally => new TranslatableString(getKey(@"skin_mounted_externally"), @"Skin is mounted externally");
private static string getKey(string key) => $@"{prefix}:{key}";
}
}
@@ -13,6 +13,7 @@ using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
using osu.Framework.Input.Events;
using osu.Framework.Localisation;
using osu.Framework.Logging;
using osu.Framework.Platform;
using osu.Framework.Testing;
@@ -107,7 +108,7 @@ namespace osu.Game.Overlays.SkinEditor
throw new InvalidOperationException("Cannot start multiple concurrent external edits!");
Show();
showSpinner("Mounting external skin...");
showSpinner(EditorStrings.ExternalEditExporting);
setGlobalSkinDisabled(true);
await Task.Delay(500).ConfigureAwait(true);
@@ -120,7 +121,7 @@ namespace osu.Game.Overlays.SkinEditor
{
Logger.Log($"Failed to initialize external edit operation: {ex}", LoggingTarget.Database, LogLevel.Error);
setGlobalSkinDisabled(false);
Schedule(() => showSpinner("Export failed!"));
Schedule(() => showSpinner(EditorStrings.ExportFailed));
Scheduler.AddDelayed(Hide, 1000);
return Task.FromException(ex);
}
@@ -131,7 +132,7 @@ namespace osu.Game.Overlays.SkinEditor
{
new OsuSpriteText
{
Text = "Skin is mounted externally",
Text = SkinEditorStrings.SkinMountedExternally,
Font = OsuFont.Default.With(size: 30),
Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre,
@@ -143,11 +144,11 @@ namespace osu.Game.Overlays.SkinEditor
Origin = Anchor.TopCentre,
Width = 350,
AutoSizeAxes = Axes.Y,
Text = "Any changes made to the exported folder will be imported to the game, including file additions, modifications and deletions.",
Text = EditorStrings.ExternalEditMountedExplanation,
},
new PurpleRoundedButton
{
Text = "Open folder",
Text = EditorStrings.OpenFolder,
Width = 350,
Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre,
@@ -198,7 +199,7 @@ namespace osu.Game.Overlays.SkinEditor
Debug.Assert(taskCompletionSource != null);
showSpinner("Cleaning up...");
showSpinner(EditorStrings.ExternalEditCleaningUp);
await Task.Delay(500).ConfigureAwait(true);
try
@@ -208,7 +209,7 @@ namespace osu.Game.Overlays.SkinEditor
catch (Exception ex)
{
Logger.Log($"Failed to finish external edit operation: {ex}", LoggingTarget.Database, LogLevel.Error);
showSpinner("Import failed!");
showSpinner(EditorStrings.ImportFailed);
Scheduler.AddDelayed(Hide, 1000);
setGlobalSkinDisabled(false);
taskCompletionSource.SetException(ex);
@@ -275,7 +276,7 @@ namespace osu.Game.Overlays.SkinEditor
return base.OnPressed(e);
}
private void showSpinner(string text)
private void showSpinner(LocalisableString text)
{
foreach (var b in flow.ChildrenOfType<RoundedButton>())
b.Enabled.Value = false;
@@ -9,6 +9,7 @@ using osu.Framework.Graphics.Sprites;
using osu.Game.Graphics;
using osu.Game.Graphics.Containers;
using osu.Game.Graphics.UserInterfaceV2;
using osu.Game.Localisation;
using osuTK;
namespace osu.Game.Overlays.SkinEditor
@@ -56,7 +57,7 @@ namespace osu.Game.Overlays.SkinEditor
TextAnchor = Anchor.Centre,
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
Text = "Please navigate to a skinnable screen using the scene library",
Text = SkinEditorStrings.NavigateToSkinnableScreen,
},
new RoundedButton
{
@@ -65,7 +66,7 @@ namespace osu.Game.Overlays.SkinEditor
Width = 200,
Margin = new MarginPadding { Top = 20 },
Action = () => skinEditorOverlay?.Hide(),
Text = "Return to game"
Text = SkinEditorStrings.ReturnToGame,
}
}
},
+9 -8
View File
@@ -10,6 +10,7 @@ using osu.Framework.Extensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
using osu.Framework.Localisation;
using osu.Framework.Logging;
using osu.Framework.Platform;
using osu.Framework.Screens;
@@ -118,7 +119,7 @@ namespace osu.Game.Screens.Edit
private async Task begin()
{
showSpinner("Exporting for edit...");
showSpinner(EditorStrings.ExternalEditExporting);
await Task.Delay(500).ConfigureAwait(true);
@@ -130,7 +131,7 @@ namespace osu.Game.Screens.Edit
{
Logger.Log($@"Failed to initiate external edit operation: {ex}", LoggingTarget.Database);
fileMountOperation = null;
showSpinner("Export failed!");
showSpinner(EditorStrings.ExportFailed);
await Task.Delay(1000).ConfigureAwait(true);
this.Exit();
}
@@ -139,7 +140,7 @@ namespace osu.Game.Screens.Edit
{
new OsuSpriteText
{
Text = "Beatmap is mounted externally",
Text = EditorStrings.BeatmapMountedExternally,
Font = OsuFont.Default.With(size: 30),
Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre,
@@ -151,11 +152,11 @@ namespace osu.Game.Screens.Edit
Origin = Anchor.TopCentre,
Width = 350,
AutoSizeAxes = Axes.Y,
Text = "Any changes made to the exported folder will be imported to the game, including file additions, modifications and deletions.",
Text = EditorStrings.ExternalEditMountedExplanation,
},
new PurpleRoundedButton
{
Text = "Open folder",
Text = EditorStrings.OpenFolder,
Width = 350,
Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre,
@@ -200,7 +201,7 @@ namespace osu.Game.Screens.Edit
BackButtonVisibility.Value = false;
string originalDifficulty = editor.Beatmap.Value.Beatmap.BeatmapInfo.DifficultyName;
showSpinner("Cleaning up...");
showSpinner(EditorStrings.ExternalEditCleaningUp);
Live<BeatmapSetInfo>? beatmap = null;
@@ -211,7 +212,7 @@ namespace osu.Game.Screens.Edit
catch (Exception ex)
{
Logger.Log($@"Failed to finish external edit operation: {ex}", LoggingTarget.Database);
showSpinner("Import failed!");
showSpinner(EditorStrings.ImportFailed);
await Task.Delay(1000).ConfigureAwait(true);
}
@@ -246,7 +247,7 @@ namespace osu.Game.Screens.Edit
}
}
private void showSpinner(string text)
private void showSpinner(LocalisableString text)
{
foreach (var b in flow.ChildrenOfType<RoundedButton>())
b.Enabled.Value = false;