1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-06 06:57:39 +08:00

Add localisation support for remaining input settings sections

This commit is contained in:
Dean Herbert 2021-07-16 23:03:44 +09:00
parent b3d89254a9
commit 7df7137c88
6 changed files with 122 additions and 17 deletions

View File

@ -0,0 +1,29 @@
// 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 BindingSettingsStrings
{
private const string prefix = @"osu.Game.Resources.Localisation.BindingSettings";
/// <summary>
/// "Shortcut and gameplay bindings"
/// </summary>
public static LocalisableString ShortcutAndGameplayBindings => new TranslatableString(getKey(@"shortcut_and_gameplay_bindings"), @"Shortcut and gameplay bindings");
/// <summary>
/// "Configure"
/// </summary>
public static LocalisableString Configure => new TranslatableString(getKey(@"configure"), @"Configure");
/// <summary>
/// "change global shortcut keys and gameplay bindings"
/// </summary>
public static LocalisableString ChangeBindingsButton => new TranslatableString(getKey(@"change_bindings_button"), @"change global shortcut keys and gameplay bindings");
private static string getKey(string key) => $@"{prefix}:{key}";
}
}

View File

@ -14,6 +14,21 @@ namespace osu.Game.Localisation
/// </summary>
public static LocalisableString Cancel => new TranslatableString(getKey(@"cancel"), @"Cancel");
/// <summary>
/// "Enabled"
/// </summary>
public static LocalisableString Enabled => new TranslatableString(getKey(@"enabled"), @"Enabled");
/// <summary>
/// "Width"
/// </summary>
public static LocalisableString Width => new TranslatableString(getKey(@"width"), @"Width");
/// <summary>
/// "Height"
/// </summary>
public static LocalisableString Height => new TranslatableString(getKey(@"height"), @"Height");
private static string getKey(string key) => $@"{prefix}:{key}";
}
}
}

View File

@ -0,0 +1,59 @@
// 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 TabletSettingsStrings
{
private const string prefix = @"osu.Game.Resources.Localisation.TabletSettings";
/// <summary>
/// "Tablet"
/// </summary>
public static LocalisableString Tablet => new TranslatableString(getKey(@"tablet"), @"Tablet");
/// <summary>
/// "No tablet detected!"
/// </summary>
public static LocalisableString NoTabletDetected => new TranslatableString(getKey(@"no_tablet_detected"), @"No tablet detected!");
/// <summary>
/// "Reset to full area"
/// </summary>
public static LocalisableString ResetToFullArea => new TranslatableString(getKey(@"reset_to_full_area"), @"Reset to full area");
/// <summary>
/// "Conform to current game aspect ratio"
/// </summary>
public static LocalisableString ConformToCurrentGameAspectRatio => new TranslatableString(getKey(@"conform_to_current_game_aspect_ratio"), @"Conform to current game aspect ratio");
/// <summary>
/// "X Offset"
/// </summary>
public static LocalisableString XOffset => new TranslatableString(getKey(@"x_offset"), @"X Offset");
/// <summary>
/// "Y Offset"
/// </summary>
public static LocalisableString YOffset => new TranslatableString(getKey(@"y_offset"), @"Y Offset");
/// <summary>
/// "Rotation"
/// </summary>
public static LocalisableString Rotation => new TranslatableString(getKey(@"rotation"), @"Rotation");
/// <summary>
/// "Aspect Ratio"
/// </summary>
public static LocalisableString AspectRatio => new TranslatableString(getKey(@"aspect_ratio"), @"Aspect Ratio");
/// <summary>
/// "Lock aspect ratio"
/// </summary>
public static LocalisableString LockAspectRatio => new TranslatableString(getKey(@"lock_aspect_ratio"), @"Lock aspect ratio");
private static string getKey(string key) => $@"{prefix}:{key}";
}
}

View File

@ -3,12 +3,13 @@
using osu.Framework.Graphics;
using osu.Framework.Localisation;
using osu.Game.Localisation;
namespace osu.Game.Overlays.Settings.Sections.Input
{
public class BindingSettings : SettingsSubsection
{
protected override LocalisableString Header => "Shortcut and gameplay bindings";
protected override LocalisableString Header => BindingSettingsStrings.ShortcutAndGameplayBindings;
public BindingSettings(KeyBindingPanel keyConfig)
{
@ -16,8 +17,8 @@ namespace osu.Game.Overlays.Settings.Sections.Input
{
new SettingsButton
{
Text = "Configure",
TooltipText = "change global shortcut keys and gameplay bindings",
Text = BindingSettingsStrings.Configure,
TooltipText = BindingSettingsStrings.ChangeBindingsButton,
Action = keyConfig.ToggleVisibility
},
};

View File

@ -36,7 +36,7 @@ namespace osu.Game.Overlays.Settings.Sections.Input
RelativeSizeAxes = Axes.X,
Height = height,
Width = 0.25f,
Text = $"{presetRotation}º",
Text = $@"{presetRotation}º",
Action = () => tabletHandler.Rotation.Value = presetRotation,
});
}

View File

@ -11,6 +11,7 @@ using osu.Framework.Platform;
using osu.Framework.Threading;
using osu.Game.Graphics.Sprites;
using osuTK;
using osu.Game.Localisation;
namespace osu.Game.Overlays.Settings.Sections.Input
{
@ -53,7 +54,7 @@ namespace osu.Game.Overlays.Settings.Sections.Input
private OsuSpriteText noTabletMessage;
protected override LocalisableString Header => "Tablet";
protected override LocalisableString Header => TabletSettingsStrings.Tablet;
public TabletSettings(ITabletHandler tabletHandler)
{
@ -67,14 +68,14 @@ namespace osu.Game.Overlays.Settings.Sections.Input
{
new SettingsCheckbox
{
LabelText = "Enabled",
LabelText = CommonStrings.Enabled,
Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre,
Current = tabletHandler.Enabled
},
noTabletMessage = new OsuSpriteText
{
Text = "No tablet detected!",
Text = TabletSettingsStrings.NoTabletDetected,
Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre,
Padding = new MarginPadding { Horizontal = SettingsPanel.CONTENT_MARGINS }
@ -95,7 +96,7 @@ namespace osu.Game.Overlays.Settings.Sections.Input
},
new DangerousSettingsButton
{
Text = "Reset to full area",
Text = TabletSettingsStrings.ResetToFullArea,
Action = () =>
{
aspectLock.Value = false;
@ -106,7 +107,7 @@ namespace osu.Game.Overlays.Settings.Sections.Input
},
new SettingsButton
{
Text = "Conform to current game aspect ratio",
Text = TabletSettingsStrings.ConformToCurrentGameAspectRatio,
Action = () =>
{
forceAspectRatio((float)host.Window.ClientSize.Width / host.Window.ClientSize.Height);
@ -115,43 +116,43 @@ namespace osu.Game.Overlays.Settings.Sections.Input
new SettingsSlider<float>
{
TransferValueOnCommit = true,
LabelText = "X Offset",
LabelText = TabletSettingsStrings.XOffset,
Current = offsetX
},
new SettingsSlider<float>
{
TransferValueOnCommit = true,
LabelText = "Y Offset",
LabelText = TabletSettingsStrings.YOffset,
Current = offsetY
},
new SettingsSlider<float>
{
TransferValueOnCommit = true,
LabelText = "Rotation",
LabelText = TabletSettingsStrings.Rotation,
Current = rotation
},
new RotationPresetButtons(tabletHandler),
new SettingsSlider<float>
{
TransferValueOnCommit = true,
LabelText = "Aspect Ratio",
LabelText = TabletSettingsStrings.AspectRatio,
Current = aspectRatio
},
new SettingsCheckbox
{
LabelText = "Lock aspect ratio",
LabelText = TabletSettingsStrings.LockAspectRatio,
Current = aspectLock
},
new SettingsSlider<float>
{
TransferValueOnCommit = true,
LabelText = "Width",
LabelText = CommonStrings.Width,
Current = sizeX
},
new SettingsSlider<float>
{
TransferValueOnCommit = true,
LabelText = "Height",
LabelText = CommonStrings.Height,
Current = sizeY
},
}