1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-14 10:12:54 +08:00

Merge pull request #22236 from Feodor0090/skin-editor-loc

Localise skin editor
This commit is contained in:
Dean Herbert 2023-01-17 12:27:43 +09:00 committed by GitHub
commit c085421029
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 68 additions and 17 deletions

View File

@ -219,7 +219,7 @@ namespace osu.Game.Tests.Visual.Navigation
AddStep("Click gameplay scene button", () =>
{
InputManager.MoveMouseTo(skinEditor.ChildrenOfType<SkinEditorSceneLibrary.SceneButton>().First(b => b.Text == "Gameplay"));
InputManager.MoveMouseTo(skinEditor.ChildrenOfType<SkinEditorSceneLibrary.SceneButton>().First(b => b.Text.ToString() == "Gameplay"));
InputManager.Click(MouseButton.Left);
});

View File

@ -154,6 +154,11 @@ namespace osu.Game.Localisation
/// </summary>
public static LocalisableString Exit => new TranslatableString(getKey(@"exit"), @"Exit");
/// <summary>
/// "Revert to default"
/// </summary>
public static LocalisableString RevertToDefault => new TranslatableString(getKey(@"revert_to_default"), @"Revert to default");
private static string getKey(string key) => $@"{prefix}:{key}";
}
}

View File

@ -0,0 +1,44 @@
// 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>
/// "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

@ -6,6 +6,7 @@
using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Extensions.LocalisationExtensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Effects;
@ -17,6 +18,7 @@ using osu.Game.Graphics;
using osu.Game.Graphics.Containers;
using osu.Game.Graphics.UserInterface;
using osuTK;
using osu.Game.Localisation;
namespace osu.Game.Overlays
{
@ -96,7 +98,7 @@ namespace osu.Game.Overlays
FinishTransforms(true);
}
public override LocalisableString TooltipText => "revert to default";
public override LocalisableString TooltipText => CommonStrings.RevertToDefault.ToLower();
protected override bool OnHover(HoverEvent e)
{

View File

@ -10,6 +10,7 @@ using osu.Framework.Logging;
using osu.Game.Graphics;
using osu.Game.Graphics.Sprites;
using osu.Game.Graphics.UserInterface;
using osu.Game.Localisation;
using osu.Game.Overlays;
using osu.Game.Screens.Edit.Components;
using osu.Game.Screens.Play.HUD;
@ -26,7 +27,7 @@ namespace osu.Game.Skinning.Editor
private FillFlowContainer fill = null!;
public SkinComponentToolbox(CompositeDrawable? target = null)
: base("Components")
: base(SkinEditorStrings.Components)
{
this.target = target;
}

View File

@ -109,7 +109,7 @@ namespace osu.Game.Skinning.Editor
{
new Container
{
Name = "Menu container",
Name = @"Menu container",
RelativeSizeAxes = Axes.X,
Depth = float.MinValue,
Height = MENU_HEIGHT,
@ -122,14 +122,14 @@ namespace osu.Game.Skinning.Editor
RelativeSizeAxes = Axes.Both,
Items = new[]
{
new MenuItem("File")
new MenuItem(CommonStrings.MenuBarFile)
{
Items = new[]
{
new EditorMenuItem("Save", MenuItemType.Standard, Save),
new EditorMenuItem("Revert to default", MenuItemType.Destructive, revert),
new EditorMenuItem(Resources.Localisation.Web.CommonStrings.ButtonsSave, MenuItemType.Standard, Save),
new EditorMenuItem(CommonStrings.RevertToDefault, MenuItemType.Destructive, revert),
new EditorMenuItemSpacer(),
new EditorMenuItem("Exit", MenuItemType.Standard, () => skinEditorOverlay?.Hide()),
new EditorMenuItem(CommonStrings.Exit, MenuItemType.Standard, () => skinEditorOverlay?.Hide()),
},
},
}
@ -234,7 +234,6 @@ namespace osu.Game.Skinning.Editor
// Immediately clear the previous blueprint container to ensure it doesn't try to interact with the old target.
content?.Clear();
Scheduler.AddOnce(loadBlueprintContainer);
Scheduler.AddOnce(populateSettings);
@ -253,7 +252,7 @@ namespace osu.Game.Skinning.Editor
{
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.AddText("Currently editing ", cp =>
{

View File

@ -16,6 +16,7 @@ using osu.Game.Graphics;
using osu.Game.Graphics.Containers;
using osu.Game.Graphics.Sprites;
using osu.Game.Graphics.UserInterface;
using osu.Game.Localisation;
using osu.Game.Overlays;
using osu.Game.Rulesets;
using osu.Game.Rulesets.Mods;
@ -66,7 +67,7 @@ namespace osu.Game.Skinning.Editor
{
new FillFlowContainer
{
Name = "Scene library",
Name = @"Scene library",
AutoSizeAxes = Axes.X,
RelativeSizeAxes = Axes.Y,
Spacing = new Vector2(padding),
@ -76,14 +77,14 @@ namespace osu.Game.Skinning.Editor
{
new OsuSpriteText
{
Text = "Scene library",
Text = SkinEditorStrings.SceneLibrary,
Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft,
Margin = new MarginPadding(10),
},
new SceneButton
{
Text = "Song Select",
Text = SkinEditorStrings.SongSelect,
Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft,
Action = () => performer?.PerformFromScreen(screen =>
@ -96,7 +97,7 @@ namespace osu.Game.Skinning.Editor
},
new SceneButton
{
Text = "Gameplay",
Text = SkinEditorStrings.Gameplay,
Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft,
Action = () => performer?.PerformFromScreen(screen =>

View File

@ -1,12 +1,11 @@
// 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.
#nullable disable
using System.Linq;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Game.Configuration;
using osu.Game.Localisation;
using osu.Game.Screens.Edit.Components;
using osuTK;
@ -17,7 +16,7 @@ namespace osu.Game.Skinning.Editor
protected override Container<Drawable> Content { get; }
public SkinSettingsToolbox(Drawable component)
: base($"Settings ({component.GetType().Name})")
: base(SkinEditorStrings.Settings(component.GetType().Name))
{
base.Content.Add(Content = new FillFlowContainer
{