Add localisation of beatmaps screen

This commit is contained in:
Dean Herbert
2022-04-28 19:33:16 +09:00
parent 14316855f9
commit 694f33b827
2 changed files with 64 additions and 12 deletions

View File

@ -0,0 +1,54 @@
// 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 FirstRunSetupBeatmapScreenStrings
{
private const string prefix = @"osu.Game.Resources.Localisation.FirstRunSetupBeatmapScreen";
/// <summary>
/// "Obtaining Beatmaps"
/// </summary>
public static LocalisableString Header => new TranslatableString(getKey(@"header"), @"Obtaining Beatmaps");
/// <summary>
/// "&quot;Beatmaps&quot; are what we call playable levels. osu! doesn&#39;t come with any beatmaps pre-loaded. This step will help you get started on your beatmap collection."
/// </summary>
public static LocalisableString Description => new TranslatableString(getKey(@"description"), @"""Beatmaps"" are what we call playable levels. osu! doesn't come with any beatmaps pre-loaded. This step will help you get started on your beatmap collection.");
/// <summary>
/// "If you are a new player, we recommend playing through the tutorial to get accustomed to the gameplay."
/// </summary>
public static LocalisableString TutorialDescription => new TranslatableString(getKey(@"tutorial_description"), @"If you are a new player, we recommend playing through the tutorial to get accustomed to the gameplay.");
/// <summary>
/// "Get the osu! tutorial"
/// </summary>
public static LocalisableString TutorialButton => new TranslatableString(getKey(@"tutorial_button"), @"Get the osu! tutorial");
/// <summary>
/// "To get you started, we have some recommended beatmaps."
/// </summary>
public static LocalisableString BundledDescription => new TranslatableString(getKey(@"bundled_description"), @"To get you started, we have some recommended beatmaps.");
/// <summary>
/// "Get recommended beatmaps"
/// </summary>
public static LocalisableString BundledButton => new TranslatableString(getKey(@"bundled_button"), @"Get recommended beatmaps");
/// <summary>
/// "You can also obtain more beatmaps from the main menu &quot;browse&quot; button at any time."
/// </summary>
public static LocalisableString ObtainMoreBeatmaps => new TranslatableString(getKey(@"obtain_more_beatmaps"), @"You can also obtain more beatmaps from the main menu ""browse"" button at any time.");
/// <summary>
/// "You currently have {0} beatmap(s) loaded!"
/// </summary>
public static LocalisableString CurrentlyLoadedBeatmaps(int beatmaps) => new TranslatableString(getKey(@"currently_loaded_beatmaps"), @"You currently have {0} beatmap(s) loaded!", beatmaps);
private static string getKey(string key) => $@"{prefix}:{key}";
}
}

View File

@ -3,10 +3,11 @@
// See the LICENCE file in the repository root for full licence text. // See the LICENCE file in the repository root for full licence text.
using System; using System;
using System.ComponentModel;
using System.Linq; using System.Linq;
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Localisation;
using osu.Game.Beatmaps; using osu.Game.Beatmaps;
using osu.Game.Beatmaps.Drawables; using osu.Game.Beatmaps.Drawables;
using osu.Game.Database; using osu.Game.Database;
@ -18,11 +19,10 @@ using osu.Game.Localisation;
using osu.Game.Online; using osu.Game.Online;
using osuTK; using osuTK;
using Realms; using Realms;
using Container = osu.Framework.Graphics.Containers.Container;
namespace osu.Game.Overlays.FirstRunSetup namespace osu.Game.Overlays.FirstRunSetup
{ {
[Description("Obtaining Beatmaps")] [LocalisableDescription(typeof(FirstRunSetupBeatmapScreenStrings), nameof(FirstRunSetupBeatmapScreenStrings.Header))]
public class ScreenBeatmaps : FirstRunSetupScreen public class ScreenBeatmaps : FirstRunSetupScreen
{ {
private ProgressRoundedButton downloadBundledButton = null!; private ProgressRoundedButton downloadBundledButton = null!;
@ -52,8 +52,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))
{ {
Colour = OverlayColourProvider.Content1, Colour = OverlayColourProvider.Content1,
Text = Text = FirstRunSetupBeatmapScreenStrings.Description,
"\"Beatmaps\" are what we call playable levels. osu! doesn't come with any beatmaps pre-loaded. This step will help you get started on your beatmap collection.",
RelativeSizeAxes = Axes.X, RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y AutoSizeAxes = Axes.Y
}, },
@ -76,8 +75,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))
{ {
Colour = OverlayColourProvider.Content1, Colour = OverlayColourProvider.Content1,
Text = Text = FirstRunSetupBeatmapScreenStrings.TutorialDescription,
"If you are a new player, we recommend playing through the tutorial to get accustomed to the gameplay.",
RelativeSizeAxes = Axes.X, RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y AutoSizeAxes = Axes.Y
}, },
@ -87,13 +85,13 @@ namespace osu.Game.Overlays.FirstRunSetup
Anchor = Anchor.TopCentre, Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre, Origin = Anchor.TopCentre,
BackgroundColour = colours.Pink3, BackgroundColour = colours.Pink3,
Text = "Get the osu! tutorial", Text = FirstRunSetupBeatmapScreenStrings.TutorialButton,
Action = downloadTutorial Action = downloadTutorial
}, },
new OsuTextFlowContainer(cp => cp.Font = OsuFont.Default.With(size: 20)) new OsuTextFlowContainer(cp => cp.Font = OsuFont.Default.With(size: 20))
{ {
Colour = OverlayColourProvider.Content1, Colour = OverlayColourProvider.Content1,
Text = "To get you started, we have some recommended beatmaps.", Text = FirstRunSetupBeatmapScreenStrings.BundledDescription,
RelativeSizeAxes = Axes.X, RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y AutoSizeAxes = Axes.Y
}, },
@ -103,7 +101,7 @@ namespace osu.Game.Overlays.FirstRunSetup
Anchor = Anchor.TopCentre, Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre, Origin = Anchor.TopCentre,
BackgroundColour = colours.Blue3, BackgroundColour = colours.Blue3,
Text = "Get recommended beatmaps", Text = FirstRunSetupBeatmapScreenStrings.BundledButton,
Action = downloadBundled Action = downloadBundled
}, },
new OsuTextFlowContainer(cp => cp.Font = OsuFont.Default.With(size: 20)) new OsuTextFlowContainer(cp => cp.Font = OsuFont.Default.With(size: 20))
@ -135,7 +133,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))
{ {
Colour = OverlayColourProvider.Content1, Colour = OverlayColourProvider.Content1,
Text = "You can also obtain more beatmaps from the main menu \"browse\" button at any time.", Text = FirstRunSetupBeatmapScreenStrings.ObtainMoreBeatmaps,
RelativeSizeAxes = Axes.X, RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y AutoSizeAxes = Axes.Y
}, },
@ -157,7 +155,7 @@ namespace osu.Game.Overlays.FirstRunSetup
private void beatmapsChanged(IRealmCollection<BeatmapSetInfo> sender, ChangeSet? changes, Exception error) private void beatmapsChanged(IRealmCollection<BeatmapSetInfo> sender, ChangeSet? changes, Exception error)
{ {
currentlyLoadedBeatmaps.Text = $"You currently have {sender.Count} beatmap(s) loaded!"; currentlyLoadedBeatmaps.Text = FirstRunSetupBeatmapScreenStrings.CurrentlyLoadedBeatmaps(sender.Count);
if (sender.Count == 0) if (sender.Count == 0)
{ {