Localise editor's UI

This commit is contained in:
ansel 2023-01-16 19:55:28 +03:00
parent 6eb5508404
commit 17aeb0ec19
5 changed files with 62 additions and 13 deletions

View File

@ -0,0 +1,49 @@
// 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 SkinEditorStrings
{
private const string prefix = @"osu.Game.Resources.Localisation.SkinEditor";
/// <summary>
/// "Skin editor"
/// </summary>
public static LocalisableString SkinEditor => new TranslatableString(getKey(@"skin_editor"), @"Skin editor");
/// <summary>
/// "Currently editing"
/// </summary>
public static LocalisableString CurrentlyEditing => new TranslatableString(getKey(@"currently_editing"), @"Currently editing");
/// <summary>
/// "Components"
/// </summary>
public static LocalisableString Components => new TranslatableString(getKey(@"components"), @"Components");
/// <summary>
/// "Scene library"
/// </summary>
public static LocalisableString SceneLibrary => new TranslatableString(getKey(@"scene_library"), @"Scene library");
/// <summary>
/// "Song Select"
/// </summary>
public static LocalisableString SongSelect => new TranslatableString(getKey(@"song_select"), @"Song Select");
/// <summary>
/// "Gameplay"
/// </summary>
public static LocalisableString Gameplay => new TranslatableString(getKey(@"gameplay"), @"Gameplay");
/// <summary>
/// "Settings ({0})"
/// </summary>
public static LocalisableString Settings(string arg0) => new TranslatableString(getKey(@"settings"), @"Settings ({0})", arg0);
private static string getKey(string key) => $@"{prefix}:{key}";
}
}

View File

@ -10,6 +10,7 @@
using osu.Game.Graphics; using osu.Game.Graphics;
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; using osu.Game.Overlays;
using osu.Game.Screens.Edit.Components; using osu.Game.Screens.Edit.Components;
using osu.Game.Screens.Play.HUD; using osu.Game.Screens.Play.HUD;
@ -26,7 +27,7 @@ public partial class SkinComponentToolbox : EditorSidebarSection
private FillFlowContainer fill = null!; private FillFlowContainer fill = null!;
public SkinComponentToolbox(CompositeDrawable? target = null) public SkinComponentToolbox(CompositeDrawable? target = null)
: base("Components") : base(SkinEditorStrings.Components)
{ {
this.target = target; this.target = target;
} }

View File

@ -109,7 +109,7 @@ private void load()
{ {
new Container new Container
{ {
Name = "Menu container", Name = @"Menu container",
RelativeSizeAxes = Axes.X, RelativeSizeAxes = Axes.X,
Depth = float.MinValue, Depth = float.MinValue,
Height = MENU_HEIGHT, Height = MENU_HEIGHT,
@ -234,7 +234,6 @@ public void UpdateTargetScreen(Drawable targetScreen)
// Immediately clear the previous blueprint container to ensure it doesn't try to interact with the old target. // Immediately clear the previous blueprint container to ensure it doesn't try to interact with the old target.
content?.Clear(); content?.Clear();
Scheduler.AddOnce(loadBlueprintContainer); Scheduler.AddOnce(loadBlueprintContainer);
Scheduler.AddOnce(populateSettings); Scheduler.AddOnce(populateSettings);
@ -253,15 +252,15 @@ private void skinChanged()
{ {
headerText.Clear(); headerText.Clear();
headerText.AddParagraph("Skin editor", cp => cp.Font = OsuFont.Default.With(size: 16)); headerText.AddParagraph(SkinEditorStrings.SkinEditor, cp => cp.Font = OsuFont.Default.With(size: 16));
headerText.NewParagraph(); headerText.NewParagraph();
headerText.AddText("Currently editing ", cp => headerText.AddText(SkinEditorStrings.CurrentlyEditing, cp =>
{ {
cp.Font = OsuFont.Default.With(size: 12); cp.Font = OsuFont.Default.With(size: 12);
cp.Colour = colours.Yellow; cp.Colour = colours.Yellow;
}); });
headerText.AddText($"{currentSkin.Value.SkinInfo}", cp => headerText.AddText($" {currentSkin.Value.SkinInfo}", cp =>
{ {
cp.Font = OsuFont.Default.With(size: 12, weight: FontWeight.Bold); cp.Font = OsuFont.Default.With(size: 12, weight: FontWeight.Bold);
cp.Colour = colours.Yellow; cp.Colour = colours.Yellow;

View File

@ -16,6 +16,7 @@
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; using osu.Game.Overlays;
using osu.Game.Rulesets; using osu.Game.Rulesets;
using osu.Game.Rulesets.Mods; using osu.Game.Rulesets.Mods;
@ -66,7 +67,7 @@ private void load(OverlayColourProvider overlayColourProvider)
{ {
new FillFlowContainer new FillFlowContainer
{ {
Name = "Scene library", Name = @"Scene library",
AutoSizeAxes = Axes.X, AutoSizeAxes = Axes.X,
RelativeSizeAxes = Axes.Y, RelativeSizeAxes = Axes.Y,
Spacing = new Vector2(padding), Spacing = new Vector2(padding),
@ -76,14 +77,14 @@ private void load(OverlayColourProvider overlayColourProvider)
{ {
new OsuSpriteText new OsuSpriteText
{ {
Text = "Scene library", Text = SkinEditorStrings.SceneLibrary,
Anchor = Anchor.CentreLeft, Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft, Origin = Anchor.CentreLeft,
Margin = new MarginPadding(10), Margin = new MarginPadding(10),
}, },
new SceneButton new SceneButton
{ {
Text = "Song Select", Text = SkinEditorStrings.SongSelect,
Anchor = Anchor.CentreLeft, Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft, Origin = Anchor.CentreLeft,
Action = () => performer?.PerformFromScreen(screen => Action = () => performer?.PerformFromScreen(screen =>
@ -96,7 +97,7 @@ private void load(OverlayColourProvider overlayColourProvider)
}, },
new SceneButton new SceneButton
{ {
Text = "Gameplay", Text = SkinEditorStrings.Gameplay,
Anchor = Anchor.CentreLeft, Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft, Origin = Anchor.CentreLeft,
Action = () => performer?.PerformFromScreen(screen => Action = () => performer?.PerformFromScreen(screen =>

View File

@ -1,12 +1,11 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // 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. // See the LICENCE file in the repository root for full licence text.
#nullable disable
using System.Linq; using System.Linq;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Game.Configuration; using osu.Game.Configuration;
using osu.Game.Localisation;
using osu.Game.Screens.Edit.Components; using osu.Game.Screens.Edit.Components;
using osuTK; using osuTK;
@ -17,7 +16,7 @@ internal partial class SkinSettingsToolbox : EditorSidebarSection
protected override Container<Drawable> Content { get; } protected override Container<Drawable> Content { get; }
public SkinSettingsToolbox(Drawable component) public SkinSettingsToolbox(Drawable component)
: base($"Settings ({component.GetType().Name})") : base(SkinEditorStrings.Settings(component.GetType().Name))
{ {
base.Content.Add(Content = new FillFlowContainer base.Content.Add(Content = new FillFlowContainer
{ {