1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-13 04:32:57 +08:00

Localize non-localizable setting items

This commit is contained in:
アズタケ 2022-09-16 18:31:02 +09:00
parent 8d725f7744
commit c0e2ba419e
18 changed files with 163 additions and 27 deletions

View File

@ -49,6 +49,16 @@ namespace osu.Game.Localisation
/// </summary>
public static LocalisableString CompactRealm => new TranslatableString(getKey(@"compact_realm"), @"Compact realm");
/// <summary>
/// "Block realm"
/// </summary>
public static LocalisableString BlockRealm => new TranslatableString(getKey(@"block_realm"), @"Block realm");
/// <summary>
/// "Unblock realm"
/// </summary>
public static LocalisableString UnblockRealm => new TranslatableString(getKey(@"unblock_realm"), @"Unblock realm");
private static string getKey(string key) => $"{prefix}:{key}";
}
}

View File

@ -64,6 +64,11 @@ namespace osu.Game.Localisation
/// </summary>
public static LocalisableString RunSetupWizard => new TranslatableString(getKey(@"run_setup_wizard"), @"Run setup wizard");
/// <summary>
/// "You are running the latest release ({0})"
/// </summary>
public static LocalisableString RunningLatestRelease(string arg0) => new TranslatableString(getKey(@"running_latest_release"), @"You are running the latest release ({0})", arg0);
private static string getKey(string key) => $"{prefix}:{key}";
}
}

View File

@ -14,11 +14,72 @@ namespace osu.Game.Localisation
/// </summary>
public static LocalisableString MaintenanceSectionHeader => new TranslatableString(getKey(@"maintenance_section_header"), @"Maintenance");
/// <summary>
/// "Beatmaps"
/// </summary>
public static LocalisableString Beatmaps => new TranslatableString(getKey(@"beatmaps"), @"Beatmaps");
/// <summary>
/// "Skins"
/// </summary>
public static LocalisableString Skins => new TranslatableString(getKey(@"skins"), @"Skins");
/// <summary>
/// "Collections"
/// </summary>
public static LocalisableString Collections => new TranslatableString(getKey(@"collections"), @"Collections");
/// <summary>
/// "Scores"
/// </summary>
public static LocalisableString Scores => new TranslatableString(getKey(@"scores"), @"Scores");
/// <summary>
/// "Mod presets"
/// </summary>
public static LocalisableString ModPresets => new TranslatableString(getKey(@"mod_presets"), @"Mod presets");
/// <summary>
/// "Select directory"
/// </summary>
public static LocalisableString SelectDirectory => new TranslatableString(getKey(@"select_directory"), @"Select directory");
/// <summary>
/// "Migration in progress"
/// </summary>
public static LocalisableString MigrationInProgress => new TranslatableString(getKey(@"migration_in_progress"), @"Migration in progress");
/// <summary>
/// "This could take a few minutes depending on the speed of your disk(s)."
/// </summary>
public static LocalisableString MigrationDescription => new TranslatableString(getKey(@"migration_description"), @"This could take a few minutes depending on the speed of your disk(s).");
/// <summary>
/// "Please avoid interacting with the game!"
/// </summary>
public static LocalisableString ProhibitedInteractDuringMigration => new TranslatableString(getKey(@"prohibited_interact_during_migration"), @"Please avoid interacting with the game!");
/// <summary>
/// "Some files couldn't be cleaned up during migration. Clicking this notification will open the folder so you can manually clean things up."
/// </summary>
public static LocalisableString FailedCleanupNotification => new TranslatableString(getKey(@"failed_cleanup_notification"), @"Some files couldn't be cleaned up during migration. Clicking this notification will open the folder so you can manually clean things up.");
/// <summary>
/// "Please select a new location"
/// </summary>
public static LocalisableString SelectNewLocation => new TranslatableString(getKey(@"select_new_location"), @"Please select a new location");
/// <summary>
/// "The target directory already seems to have an osu! install. Use that data instead?"
/// </summary>
public static LocalisableString TargetDirectoryAlreadyInstalledOsu => new TranslatableString(getKey(@"target_directory_already_installed_osu"), @"The target directory already seems to have an osu! install. Use that data instead?");
/// <summary>
/// "To complete this operation, osu! will close. Please open it again to use the new data location."
/// </summary>
public static LocalisableString RestartAndReOpenRequiredForCompletion => new TranslatableString(getKey(@"restart_and_re_open_required_for_completion"), @"To complete this operation, osu! will close. Please open it again to use the new data location.");
/// <summary>
/// "Import beatmaps from stable"
/// </summary>
@ -84,6 +145,56 @@ namespace osu.Game.Localisation
/// </summary>
public static LocalisableString RestoreAllRecentlyDeletedModPresets => new TranslatableString(getKey(@"restore_all_recently_deleted_mod_presets"), @"Restore all recently deleted mod presets");
/// <summary>
/// "Deleted all collections!"
/// </summary>
public static LocalisableString DeletedAllCollections => new TranslatableString(getKey(@"deleted_all_collections"), @"Deleted all collections!");
/// <summary>
/// "Deleted all mod presets!"
/// </summary>
public static LocalisableString DeletedAllModPresets => new TranslatableString(getKey(@"deleted_all_mod_presets"), @"Deleted all mod presets!");
/// <summary>
/// "Restored all deleted mod presets!"
/// </summary>
public static LocalisableString RestoredAllDeletedModPresets => new TranslatableString(getKey(@"restored_all_deleted_mod_presets"), @"Restored all deleted mod presets!");
/// <summary>
/// "Everything?"
/// </summary>
public static LocalisableString MassDeleteConfirmation => new TranslatableString(getKey(@"mass_delete_confirmation"), @"Everything?");
/// <summary>
/// "All beatmap videos? This cannot be undone!"
/// </summary>
public static LocalisableString MassVideoDeleteConfirmation => new TranslatableString(getKey(@"mass_video_delete_confirmation"), @"All beatmap videos? This cannot be undone!");
/// <summary>
/// "Failed to automatically locate an osu!stable installation."
/// </summary>
public static LocalisableString StableDirectoryLocationHeader => new TranslatableString(getKey(@"stable_directory_location_header"), @"Failed to automatically locate an osu!stable installation.");
/// <summary>
/// "An existing install could not be located. If you know where it is, you can help locate it."
/// </summary>
public static LocalisableString StableDirectoryLocationBody => new TranslatableString(getKey(@"stable_directory_location_body"), @"An existing install could not be located. If you know where it is, you can help locate it.");
/// <summary>
/// "Sure! I know where it is located!"
/// </summary>
public static LocalisableString StableDirectoryLocationOk => new TranslatableString(getKey(@"stable_directory_location_ok"), @"Sure! I know where it is located!");
/// <summary>
/// "Actually I don't have osu!stable installed."
/// </summary>
public static LocalisableString StableDirectoryLocationCancel => new TranslatableString(getKey(@"stable_directory_location_cancel"), @"Actually I don't have osu!stable installed.");
/// <summary>
/// "Please select your osu!stable install location"
/// </summary>
public static LocalisableString StableDirectorySelectHeader => new TranslatableString(getKey(@"stable_directory_select_header"), @"Please select your osu!stable install location");
private static string getKey(string key) => $"{prefix}:{key}";
}
}

View File

@ -19,6 +19,11 @@ namespace osu.Game.Localisation
/// </summary>
public static LocalisableString NoTabletDetected => new TranslatableString(getKey(@"no_tablet_detected"), @"No tablet detected!");
/// <summary>
/// "If your tablet is not detected, please read [this FAQ]({0}) for troubleshooting steps."
/// </summary>
public static LocalisableString NoTabletDetectedDescription(string url) => new TranslatableString(getKey(@"no_tablet_detected_description"), @"If your tablet is not detected, please read [this FAQ]({0}) for troubleshooting steps.", url);
/// <summary>
/// "Reset to full area"
/// </summary>

View File

@ -46,11 +46,11 @@ namespace osu.Game.Overlays.Settings.Sections.DebugSettings
},
blockAction = new SettingsButton
{
Text = "Block realm",
Text = DebugSettingsStrings.BlockRealm,
},
unblockAction = new SettingsButton
{
Text = "Unblock realm",
Text = DebugSettingsStrings.UnblockRealm,
},
};

View File

@ -54,7 +54,7 @@ namespace osu.Game.Overlays.Settings.Sections.General
{
notifications?.Post(new SimpleNotification
{
Text = $"You are running the latest release ({game.Version})",
Text = GeneralSettingsStrings.RunningLatestRelease(game.Version),
Icon = FontAwesome.Solid.CheckCircle,
});
}

View File

@ -110,11 +110,10 @@ namespace osu.Game.Overlays.Settings.Sections.Input
if (RuntimeInfo.OS == RuntimeInfo.Platform.Windows || RuntimeInfo.OS == RuntimeInfo.Platform.Linux)
{
t.NewLine();
t.AddText("If your tablet is not detected, please read ");
t.AddLink("this FAQ", LinkAction.External, RuntimeInfo.OS == RuntimeInfo.Platform.Windows
var formattedSource = MessageFormatter.FormatText(TabletSettingsStrings.NoTabletDetectedDescription(RuntimeInfo.OS == RuntimeInfo.Platform.Windows
? @"https://opentabletdriver.net/Wiki/FAQ/Windows"
: @"https://opentabletdriver.net/Wiki/FAQ/Linux");
t.AddText(" for troubleshooting steps.");
: @"https://opentabletdriver.net/Wiki/FAQ/Linux").ToString());
t.AddLinks(formattedSource.Text, formattedSource.Links);
}
}),
}

View File

@ -13,7 +13,7 @@ namespace osu.Game.Overlays.Settings.Sections.Maintenance
{
public class BeatmapSettings : SettingsSubsection
{
protected override LocalisableString Header => "Beatmaps";
protected override LocalisableString Header => MaintenanceSettingsStrings.Beatmaps;
private SettingsButton importBeatmapsButton = null!;
private SettingsButton deleteBeatmapsButton = null!;

View File

@ -12,7 +12,7 @@ namespace osu.Game.Overlays.Settings.Sections.Maintenance
{
public class CollectionsSettings : SettingsSubsection
{
protected override LocalisableString Header => "Collections";
protected override LocalisableString Header => MaintenanceSettingsStrings.Collections;
private SettingsButton importCollectionsButton = null!;
@ -51,7 +51,7 @@ namespace osu.Game.Overlays.Settings.Sections.Maintenance
private void deleteAllCollections()
{
realm.Write(r => r.RemoveAll<BeatmapCollection>());
notificationOverlay?.Post(new ProgressCompletionNotification { Text = "Deleted all collections!" });
notificationOverlay?.Post(new ProgressCompletionNotification { Text = MaintenanceSettingsStrings.DeletedAllCollections });
}
}
}

View File

@ -2,6 +2,7 @@
// See the LICENCE file in the repository root for full licence text.
using System;
using osu.Game.Localisation;
using osu.Game.Overlays.Dialog;
namespace osu.Game.Overlays.Settings.Sections.Maintenance
@ -10,7 +11,7 @@ namespace osu.Game.Overlays.Settings.Sections.Maintenance
{
public MassDeleteConfirmationDialog(Action deleteAction)
{
BodyText = "Everything?";
BodyText = MaintenanceSettingsStrings.MassDeleteConfirmation;
DeleteAction = deleteAction;
}
}

View File

@ -2,6 +2,7 @@
// See the LICENCE file in the repository root for full licence text.
using System;
using osu.Game.Localisation;
namespace osu.Game.Overlays.Settings.Sections.Maintenance
{
@ -10,7 +11,7 @@ namespace osu.Game.Overlays.Settings.Sections.Maintenance
public MassVideoDeleteConfirmationDialog(Action deleteAction)
: base(deleteAction)
{
BodyText = "All beatmap videos? This cannot be undone!";
BodyText = MaintenanceSettingsStrings.MassVideoDeleteConfirmation;
}
}
}

View File

@ -15,6 +15,7 @@ using osu.Framework.Screens;
using osu.Game.Graphics;
using osu.Game.Graphics.Sprites;
using osu.Game.Graphics.UserInterface;
using osu.Game.Localisation;
using osu.Game.Overlays.Notifications;
using osu.Game.Screens;
using osuTK;
@ -71,14 +72,14 @@ namespace osu.Game.Overlays.Settings.Sections.Maintenance
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Text = "Migration in progress",
Text = MaintenanceSettingsStrings.MigrationInProgress,
Font = OsuFont.Default.With(size: 40)
},
new OsuSpriteText
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Text = "This could take a few minutes depending on the speed of your disk(s).",
Text = MaintenanceSettingsStrings.MigrationDescription,
Font = OsuFont.Default.With(size: 30)
},
new LoadingSpinner(true)
@ -89,7 +90,7 @@ namespace osu.Game.Overlays.Settings.Sections.Maintenance
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Text = "Please avoid interacting with the game!",
Text = MaintenanceSettingsStrings.ProhibitedInteractDuringMigration,
Font = OsuFont.Default.With(size: 30)
},
}
@ -111,7 +112,7 @@ namespace osu.Game.Overlays.Settings.Sections.Maintenance
{
notifications.Post(new SimpleNotification
{
Text = "Some files couldn't be cleaned up during migration. Clicking this notification will open the folder so you can manually clean things up.",
Text = MaintenanceSettingsStrings.FailedCleanupNotification,
Activated = () =>
{
originalStorage.PresentExternally();

View File

@ -12,6 +12,7 @@ using osu.Framework.Logging;
using osu.Framework.Platform;
using osu.Framework.Screens;
using osu.Game.IO;
using osu.Game.Localisation;
using osu.Game.Overlays.Dialog;
namespace osu.Game.Overlays.Settings.Sections.Maintenance
@ -35,7 +36,7 @@ namespace osu.Game.Overlays.Settings.Sections.Maintenance
public override bool HideOverlaysOnEnter => true;
public override LocalisableString HeaderText => "Please select a new location";
public override LocalisableString HeaderText => MaintenanceSettingsStrings.SelectNewLocation;
protected override void OnSelection(DirectoryInfo directory)
{
@ -51,9 +52,9 @@ namespace osu.Game.Overlays.Settings.Sections.Maintenance
// Quick test for whether there's already an osu! install at the target path.
if (fileInfos.Any(f => f.Name == OsuGameBase.CLIENT_DATABASE_FILENAME))
{
dialogOverlay.Push(new ConfirmDialog("The target directory already seems to have an osu! install. Use that data instead?", () =>
dialogOverlay.Push(new ConfirmDialog(MaintenanceSettingsStrings.TargetDirectoryAlreadyInstalledOsu.ToString(), () =>
{
dialogOverlay.Push(new ConfirmDialog("To complete this operation, osu! will close. Please open it again to use the new data location.", () =>
dialogOverlay.Push(new ConfirmDialog(MaintenanceSettingsStrings.RestartAndReOpenRequiredForCompletion.ToString(), () =>
{
(storage as OsuStorage)?.ChangeDataPath(target.FullName);
game.Exit();

View File

@ -16,7 +16,7 @@ namespace osu.Game.Overlays.Settings.Sections.Maintenance
{
public class ModPresetSettings : SettingsSubsection
{
protected override LocalisableString Header => "Mod presets";
protected override LocalisableString Header => MaintenanceSettingsStrings.ModPresets;
[Resolved]
private RealmAccess realm { get; set; } = null!;
@ -64,7 +64,7 @@ namespace osu.Game.Overlays.Settings.Sections.Maintenance
deleteAllButton.Enabled.Value = true;
if (deletionTask.IsCompletedSuccessfully)
notificationOverlay?.Post(new ProgressCompletionNotification { Text = "Deleted all mod presets!" });
notificationOverlay?.Post(new ProgressCompletionNotification { Text = MaintenanceSettingsStrings.DeletedAllModPresets });
else if (deletionTask.IsFaulted)
Logger.Error(deletionTask.Exception, "Failed to delete all mod presets");
}
@ -81,7 +81,7 @@ namespace osu.Game.Overlays.Settings.Sections.Maintenance
undeleteButton.Enabled.Value = true;
if (undeletionTask.IsCompletedSuccessfully)
notificationOverlay?.Post(new ProgressCompletionNotification { Text = "Restored all deleted mod presets!" });
notificationOverlay?.Post(new ProgressCompletionNotification { Text = MaintenanceSettingsStrings.RestoredAllDeletedModPresets });
else if (undeletionTask.IsFaulted)
Logger.Error(undeletionTask.Exception, "Failed to restore mod presets");
}

View File

@ -12,7 +12,7 @@ namespace osu.Game.Overlays.Settings.Sections.Maintenance
{
public class ScoreSettings : SettingsSubsection
{
protected override LocalisableString Header => "Scores";
protected override LocalisableString Header => MaintenanceSettingsStrings.Scores;
private SettingsButton importScoresButton = null!;
private SettingsButton deleteScoresButton = null!;

View File

@ -12,7 +12,7 @@ namespace osu.Game.Overlays.Settings.Sections.Maintenance
{
public class SkinSettings : SettingsSubsection
{
protected override LocalisableString Header => "Skins";
protected override LocalisableString Header => MaintenanceSettingsStrings.Skins;
private SettingsButton importSkinsButton = null!;
private SettingsButton deleteSkinsButton = null!;

View File

@ -7,6 +7,7 @@ using System.Threading.Tasks;
using osu.Framework.Allocation;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Screens;
using osu.Game.Localisation;
using osu.Game.Overlays.Dialog;
using osu.Game.Screens;
@ -19,8 +20,8 @@ namespace osu.Game.Overlays.Settings.Sections.Maintenance
public StableDirectoryLocationDialog(TaskCompletionSource<string> taskCompletionSource)
{
HeaderText = "Failed to automatically locate an osu!stable installation.";
BodyText = "An existing install could not be located. If you know where it is, you can help locate it.";
HeaderText = MaintenanceSettingsStrings.StableDirectoryLocationHeader;
BodyText = MaintenanceSettingsStrings.StableDirectoryLocationBody;
Icon = FontAwesome.Solid.QuestionCircle;
Buttons = new PopupDialogButton[]

View File

@ -8,6 +8,7 @@ using System.Linq;
using System.Threading.Tasks;
using osu.Framework.Localisation;
using osu.Framework.Screens;
using osu.Game.Localisation;
namespace osu.Game.Overlays.Settings.Sections.Maintenance
{
@ -19,7 +20,7 @@ namespace osu.Game.Overlays.Settings.Sections.Maintenance
protected override bool IsValidDirectory(DirectoryInfo info) => info?.GetFiles("osu!.*.cfg").Any() ?? false;
public override LocalisableString HeaderText => "Please select your osu!stable install location";
public override LocalisableString HeaderText => MaintenanceSettingsStrings.StableDirectorySelectHeader;
public StableDirectorySelectScreen(TaskCompletionSource<string> taskCompletionSource)
{