1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-14 13:22:55 +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", () => 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); InputManager.Click(MouseButton.Left);
}); });

View File

@ -154,6 +154,11 @@ namespace osu.Game.Localisation
/// </summary> /// </summary>
public static LocalisableString Exit => new TranslatableString(getKey(@"exit"), @"Exit"); 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}"; 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.Allocation;
using osu.Framework.Bindables; using osu.Framework.Bindables;
using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Extensions.LocalisationExtensions;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Effects; using osu.Framework.Graphics.Effects;
@ -17,6 +18,7 @@ using osu.Game.Graphics;
using osu.Game.Graphics.Containers; using osu.Game.Graphics.Containers;
using osu.Game.Graphics.UserInterface; using osu.Game.Graphics.UserInterface;
using osuTK; using osuTK;
using osu.Game.Localisation;
namespace osu.Game.Overlays namespace osu.Game.Overlays
{ {
@ -96,7 +98,7 @@ namespace osu.Game.Overlays
FinishTransforms(true); FinishTransforms(true);
} }
public override LocalisableString TooltipText => "revert to default"; public override LocalisableString TooltipText => CommonStrings.RevertToDefault.ToLower();
protected override bool OnHover(HoverEvent e) protected override bool OnHover(HoverEvent e)
{ {

View File

@ -10,6 +10,7 @@ using osu.Framework.Logging;
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 @@ namespace osu.Game.Skinning.Editor
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 @@ namespace osu.Game.Skinning.Editor
{ {
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,
@ -122,14 +122,14 @@ namespace osu.Game.Skinning.Editor
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
Items = new[] Items = new[]
{ {
new MenuItem("File") new MenuItem(CommonStrings.MenuBarFile)
{ {
Items = new[] Items = new[]
{ {
new EditorMenuItem("Save", MenuItemType.Standard, Save), new EditorMenuItem(Resources.Localisation.Web.CommonStrings.ButtonsSave, MenuItemType.Standard, Save),
new EditorMenuItem("Revert to default", MenuItemType.Destructive, revert), new EditorMenuItem(CommonStrings.RevertToDefault, MenuItemType.Destructive, revert),
new EditorMenuItemSpacer(), 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. // 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,7 +252,7 @@ namespace osu.Game.Skinning.Editor
{ {
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("Currently editing ", cp =>
{ {

View File

@ -16,6 +16,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; 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 @@ namespace osu.Game.Skinning.Editor
{ {
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 @@ namespace osu.Game.Skinning.Editor
{ {
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 @@ namespace osu.Game.Skinning.Editor
}, },
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 @@ namespace osu.Game.Skinning.Editor
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
{ {