1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-26 17:02:57 +08:00

Add localisation support for all new strings

This commit is contained in:
Dean Herbert 2022-04-19 13:52:55 +09:00
parent 5dc3805005
commit e67cc293b8
7 changed files with 87 additions and 13 deletions

View File

@ -19,6 +19,16 @@ namespace osu.Game.Localisation
/// </summary> /// </summary>
public static LocalisableString Clear => new TranslatableString(getKey(@"clear"), @"Clear"); public static LocalisableString Clear => new TranslatableString(getKey(@"clear"), @"Clear");
/// <summary>
/// "Back"
/// </summary>
public static LocalisableString Back => new TranslatableString(getKey(@"back"), @"Back");
/// <summary>
/// "Finish"
/// </summary>
public static LocalisableString Finish => new TranslatableString(getKey(@"finish"), @"Finish");
/// <summary> /// <summary>
/// "Enabled" /// "Enabled"
/// </summary> /// </summary>

View File

@ -0,0 +1,58 @@
// 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 FirstRunSetupOverlayStrings
{
private const string prefix = @"osu.Game.Resources.Localisation.FirstRunSetupOverlay";
/// <summary>
/// "Get started"
/// </summary>
public static LocalisableString GetStarted => new TranslatableString(getKey(@"get_started"), @"Get started");
/// <summary>
/// "Click to resume first-run setup at any point"
/// </summary>
public static LocalisableString ClickToResumeFirstRunSetupAtAnyPoint => new TranslatableString(getKey(@"click_to_resume_first_run_setup_at_any_point"), @"Click to resume first-run setup at any point");
/// <summary>
/// "First-run setup"
/// </summary>
public static LocalisableString FirstRunSetup => new TranslatableString(getKey(@"first_run_setup"), @"First-run setup");
/// <summary>
/// "Setup osu! to suit you"
/// </summary>
public static LocalisableString SetupOsuToSuitYou => new TranslatableString(getKey(@"setup_osu_to_suit_you"), @"Setup osu! to suit you");
/// <summary>
/// "Welcome"
/// </summary>
public static LocalisableString Welcome => new TranslatableString(getKey(@"welcome"), @"Welcome");
/// <summary>
/// "Welcome to the first-run setup guide!
///
/// osu! is a very configurable game, and diving straight into the settings can sometimes be overwhelming. This guide will help you get the important choices out of the way to ensure a great first experience!"
/// </summary>
public static LocalisableString WelcomeDescription => new TranslatableString(getKey(@"welcome_description"), @"Welcome to the first-run setup guide!
osu! is a very configurable game, and diving straight into the settings can sometimes be overwhelming. This guide will help you get the important choices out of the way to ensure a great first experience!");
/// <summary>
/// "The size of the osu! user interface size can be adjusted to your liking."
/// </summary>
public static LocalisableString UIScaleDescription => new TranslatableString(getKey(@"ui_scale_description"), @"The size of the osu! user interface size can be adjusted to your liking.");
/// <summary>
/// "Next ({0})"
/// </summary>
public static LocalisableString Next(LocalisableString nextStepDescription) => new TranslatableString(getKey(@"next"), @"Next ({0})", nextStepDescription);
private static string getKey(string key) => $@"{prefix}:{key}";
}
}

View File

@ -59,6 +59,11 @@ namespace osu.Game.Localisation
/// </summary> /// </summary>
public static LocalisableString ChangeFolderLocation => new TranslatableString(getKey(@"change_folder_location"), @"Change folder location..."); public static LocalisableString ChangeFolderLocation => new TranslatableString(getKey(@"change_folder_location"), @"Change folder location...");
/// <summary>
/// "Run setup wizard"
/// </summary>
public static LocalisableString RunSetupWizard => new TranslatableString(getKey(@"run_setup_wizard"), @"Run setup wizard");
private static string getKey(string key) => $"{prefix}:{key}"; private static string getKey(string key) => $"{prefix}:{key}";
} }
} }

View File

@ -53,7 +53,7 @@ namespace osu.Game.Overlays.FirstRunSetup
{ {
new OsuTextFlowContainer(cp => cp.Font = OsuFont.Default.With(size: 24)) new OsuTextFlowContainer(cp => cp.Font = OsuFont.Default.With(size: 24))
{ {
Text = "The osu! user interface size can be adjusted to your liking.", Text = FirstRunSetupOverlayStrings.UIScaleDescription,
RelativeSizeAxes = Axes.X, RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y AutoSizeAxes = Axes.Y
}, },

View File

@ -5,6 +5,7 @@ using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Game.Graphics; using osu.Game.Graphics;
using osu.Game.Graphics.Containers; using osu.Game.Graphics.Containers;
using osu.Game.Localisation;
namespace osu.Game.Overlays.FirstRunSetup namespace osu.Game.Overlays.FirstRunSetup
{ {
@ -22,8 +23,7 @@ namespace osu.Game.Overlays.FirstRunSetup
{ {
new OsuTextFlowContainer(cp => cp.Font = OsuFont.Default.With(size: 20)) new OsuTextFlowContainer(cp => cp.Font = OsuFont.Default.With(size: 20))
{ {
Text = Text = FirstRunSetupOverlayStrings.WelcomeDescription,
"Welcome to the first-run setup guide!\n\nosu! is a very configurable game, and diving straight into the settings can sometimes be overwhelming. This guide will help you get the important choices out of the way to ensure a great first experience!",
RelativeSizeAxes = Axes.X, RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y AutoSizeAxes = Axes.Y
}, },

View File

@ -18,6 +18,7 @@ using osu.Game.Graphics;
using osu.Game.Graphics.Containers; using osu.Game.Graphics.Containers;
using osu.Game.Graphics.Sprites; using osu.Game.Graphics.Sprites;
using osu.Game.Graphics.UserInterface; using osu.Game.Graphics.UserInterface;
using osu.Game.Localisation;
using osu.Game.Overlays.FirstRunSetup; using osu.Game.Overlays.FirstRunSetup;
using osu.Game.Overlays.Notifications; using osu.Game.Overlays.Notifications;
using osu.Game.Screens; using osu.Game.Screens;
@ -58,8 +59,8 @@ namespace osu.Game.Overlays
private readonly FirstRunStep[] steps = private readonly FirstRunStep[] steps =
{ {
new FirstRunStep(typeof(ScreenWelcome), "Welcome"), new FirstRunStep(typeof(ScreenWelcome), FirstRunSetupOverlayStrings.Welcome),
new FirstRunStep(typeof(ScreenUIScale), "UI Scale"), new FirstRunStep(typeof(ScreenUIScale), GraphicsSettingsStrings.UIScaling),
}; };
private Container stackContainer = null!; private Container stackContainer = null!;
@ -129,7 +130,7 @@ namespace osu.Game.Overlays
{ {
new OsuSpriteText new OsuSpriteText
{ {
Text = "First run setup", Text = FirstRunSetupOverlayStrings.FirstRunSetup,
Font = OsuFont.Default.With(size: 32), Font = OsuFont.Default.With(size: 32),
Colour = colourProvider.Content2, Colour = colourProvider.Content2,
Anchor = Anchor.TopCentre, Anchor = Anchor.TopCentre,
@ -137,7 +138,7 @@ namespace osu.Game.Overlays
}, },
new OsuTextFlowContainer new OsuTextFlowContainer
{ {
Text = "Setup osu! to suit you", Text = FirstRunSetupOverlayStrings.SetupOsuToSuitYou,
Colour = colourProvider.Content1, Colour = colourProvider.Content1,
Anchor = Anchor.TopCentre, Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre, Origin = Anchor.TopCentre,
@ -184,7 +185,7 @@ namespace osu.Game.Overlays
BackButton = new DangerousTriangleButton BackButton = new DangerousTriangleButton
{ {
Width = 200, Width = 200,
Text = "Back", Text = CommonStrings.Back,
Action = showLastStep, Action = showLastStep,
Enabled = { Value = false }, Enabled = { Value = false },
}, },
@ -193,7 +194,7 @@ namespace osu.Game.Overlays
{ {
RelativeSizeAxes = Axes.X, RelativeSizeAxes = Axes.X,
Width = 1, Width = 1,
Text = "Get started", Text = FirstRunSetupOverlayStrings.GetStarted,
Action = showNextStep Action = showNextStep
} }
}, },
@ -263,8 +264,8 @@ namespace osu.Game.Overlays
Debug.Assert(currentStepIndex != null); Debug.Assert(currentStepIndex != null);
NextButton.Text = currentStepIndex + 1 < steps.Length NextButton.Text = currentStepIndex + 1 < steps.Length
? $"Next ({steps[currentStepIndex.Value + 1].Description})" ? FirstRunSetupOverlayStrings.Next(steps[currentStepIndex.Value + 1].Description)
: "Finish"; : CommonStrings.Finish;
} }
protected override void PopIn() protected override void PopIn()
@ -286,7 +287,7 @@ namespace osu.Game.Overlays
{ {
notificationOverlay.Post(new SimpleNotification notificationOverlay.Post(new SimpleNotification
{ {
Text = "Click here to resume initial setup at any point", Text = FirstRunSetupOverlayStrings.ClickToResumeFirstRunSetupAtAnyPoint,
Icon = FontAwesome.Solid.Horse, Icon = FontAwesome.Solid.Horse,
Activated = () => Activated = () =>
{ {

View File

@ -28,7 +28,7 @@ namespace osu.Game.Overlays.Settings.Sections
{ {
new SettingsButton new SettingsButton
{ {
Text = "Run setup wizard", Text = GeneralSettingsStrings.RunSetupWizard,
Action = () => firstRunSetupOverlay?.Show(), Action = () => firstRunSetupOverlay?.Show(),
}, },
new LanguageSettings(), new LanguageSettings(),