diff --git a/osu.Game/Localisation/StorageErrorDialogStrings.cs b/osu.Game/Localisation/StorageErrorDialogStrings.cs new file mode 100644 index 0000000000..6ad388dd1f --- /dev/null +++ b/osu.Game/Localisation/StorageErrorDialogStrings.cs @@ -0,0 +1,49 @@ +// Copyright (c) ppy Pty Ltd . 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 StorageErrorDialogStrings + { + private const string prefix = @"osu.Game.Resources.Localisation.StorageErrorDialog"; + + /// + /// "osu! storage error" + /// + public static LocalisableString StorageError => new TranslatableString(getKey(@"storage_error"), @"osu! storage error"); + + /// + /// "The specified osu! data location ("{0}") is not accessible. If it is on external storage, please reconnect the device and try again." + /// + public static LocalisableString LocationIsNotAccessible(string? loc) => new TranslatableString(getKey(@"location_is_not_accessible"), @"The specified osu! data location (""{0}"") is not accessible. If it is on external storage, please reconnect the device and try again.", loc); + + /// + /// "The specified osu! data location ("{0}") is empty. If you have moved the files, please close osu! and move them back." + /// + public static LocalisableString LocationIsEmpty(string? loc2) => new TranslatableString(getKey(@"location_is_empty"), @"The specified osu! data location (""{0}"") is empty. If you have moved the files, please close osu! and move them back.", loc2); + + /// + /// "Try again" + /// + public static LocalisableString TryAgain => new TranslatableString(getKey(@"try_again"), @"Try again"); + + /// + /// "Use default location until restart" + /// + public static LocalisableString UseDefaultLocation => new TranslatableString(getKey(@"use_default_location"), @"Use default location until restart"); + + /// + /// "Reset to default location" + /// + public static LocalisableString ResetToDefaultLocation => new TranslatableString(getKey(@"reset_to_default_location"), @"Reset to default location"); + + /// + /// "Start fresh at specified location" + /// + public static LocalisableString StartFresh => new TranslatableString(getKey(@"start_fresh"), @"Start fresh at specified location"); + + private static string getKey(string key) => $@"{prefix}:{key}"; + } +} diff --git a/osu.Game/Screens/Menu/StorageErrorDialog.cs b/osu.Game/Screens/Menu/StorageErrorDialog.cs index dd43289873..b48046d190 100644 --- a/osu.Game/Screens/Menu/StorageErrorDialog.cs +++ b/osu.Game/Screens/Menu/StorageErrorDialog.cs @@ -5,6 +5,7 @@ using System.Collections.Generic; using osu.Framework.Allocation; using osu.Framework.Graphics.Sprites; using osu.Game.IO; +using osu.Game.Localisation; using osu.Game.Overlays; using osu.Game.Overlays.Dialog; @@ -17,7 +18,7 @@ namespace osu.Game.Screens.Menu public StorageErrorDialog(OsuStorage storage, OsuStorageError error) { - HeaderText = "osu! storage error"; + HeaderText = StorageErrorDialogStrings.StorageError; Icon = FontAwesome.Solid.ExclamationTriangle; var buttons = new List(); @@ -25,13 +26,13 @@ namespace osu.Game.Screens.Menu switch (error) { case OsuStorageError.NotAccessible: - BodyText = $"The specified osu! data location (\"{storage.CustomStoragePath}\") is not accessible. If it is on external storage, please reconnect the device and try again."; + BodyText = StorageErrorDialogStrings.LocationIsNotAccessible(storage.CustomStoragePath); buttons.AddRange(new PopupDialogButton[] { new PopupDialogCancelButton { - Text = "Try again", + Text = StorageErrorDialogStrings.TryAgain, Action = () => { if (!storage.TryChangeToCustomStorage(out var nextError)) @@ -40,29 +41,29 @@ namespace osu.Game.Screens.Menu }, new PopupDialogCancelButton { - Text = "Use default location until restart", + Text = StorageErrorDialogStrings.UseDefaultLocation, }, new PopupDialogOkButton { - Text = "Reset to default location", + Text = StorageErrorDialogStrings.ResetToDefaultLocation, Action = storage.ResetCustomStoragePath }, }); break; case OsuStorageError.AccessibleButEmpty: - BodyText = $"The specified osu! data location (\"{storage.CustomStoragePath}\") is empty. If you have moved the files, please close osu! and move them back."; + BodyText = StorageErrorDialogStrings.LocationIsEmpty(storage.CustomStoragePath); // Todo: Provide the option to search for the files similar to migration. buttons.AddRange(new PopupDialogButton[] { new PopupDialogCancelButton { - Text = "Start fresh at specified location" + Text = StorageErrorDialogStrings.StartFresh }, new PopupDialogOkButton { - Text = "Reset to default location", + Text = StorageErrorDialogStrings.ResetToDefaultLocation, Action = storage.ResetCustomStoragePath }, });