diff --git a/osu.Game.Rulesets.Osu/UI/ReplayAnalysisSettings.cs b/osu.Game.Rulesets.Osu/UI/ReplayAnalysisSettings.cs index dc4730d76a..f05f3aa03a 100644 --- a/osu.Game.Rulesets.Osu/UI/ReplayAnalysisSettings.cs +++ b/osu.Game.Rulesets.Osu/UI/ReplayAnalysisSettings.cs @@ -4,6 +4,7 @@ using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Game.Configuration; +using osu.Game.Localisation; using osu.Game.Rulesets.Osu.Configuration; using osu.Game.Screens.Play.PlayerSettings; @@ -13,19 +14,19 @@ namespace osu.Game.Rulesets.Osu.UI { private readonly OsuRulesetConfigManager config; - [SettingSource("Show click markers", SettingControlType = typeof(PlayerCheckbox))] + [SettingSource(typeof(PlayerSettingsOverlayStrings), nameof(PlayerSettingsOverlayStrings.ShowClickMarkers), SettingControlType = typeof(PlayerCheckbox))] public BindableBool ShowClickMarkers { get; } = new BindableBool(); - [SettingSource("Show frame markers", SettingControlType = typeof(PlayerCheckbox))] + [SettingSource(typeof(PlayerSettingsOverlayStrings), nameof(PlayerSettingsOverlayStrings.ShowFrameMarkers), SettingControlType = typeof(PlayerCheckbox))] public BindableBool ShowAimMarkers { get; } = new BindableBool(); - [SettingSource("Show cursor path", SettingControlType = typeof(PlayerCheckbox))] + [SettingSource(typeof(PlayerSettingsOverlayStrings), nameof(PlayerSettingsOverlayStrings.ShowCursorPath), SettingControlType = typeof(PlayerCheckbox))] public BindableBool ShowCursorPath { get; } = new BindableBool(); - [SettingSource("Hide gameplay cursor", SettingControlType = typeof(PlayerCheckbox))] + [SettingSource(typeof(PlayerSettingsOverlayStrings), nameof(PlayerSettingsOverlayStrings.HideGameplayCursor), SettingControlType = typeof(PlayerCheckbox))] public BindableBool HideSkinCursor { get; } = new BindableBool(); - [SettingSource("Display length", SettingControlType = typeof(PlayerSliderBar))] + [SettingSource(typeof(PlayerSettingsOverlayStrings), nameof(PlayerSettingsOverlayStrings.DisplayLength), SettingControlType = typeof(PlayerSliderBar))] public BindableInt DisplayLength { get; } = new BindableInt { MinValue = 200, @@ -35,7 +36,7 @@ namespace osu.Game.Rulesets.Osu.UI }; public ReplayAnalysisSettings(OsuRulesetConfigManager config) - : base("Analysis Settings") + : base(PlayerSettingsOverlayStrings.AnalysisSettingsTitle) { this.config = config; } diff --git a/osu.Game/Localisation/BreakInfoStrings.cs b/osu.Game/Localisation/BreakInfoStrings.cs new file mode 100644 index 0000000000..e327676e27 --- /dev/null +++ b/osu.Game/Localisation/BreakInfoStrings.cs @@ -0,0 +1,24 @@ +// Copyright (c) ppy Pty Ltd . 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 class BreakInfoStrings + { + private const string prefix = @"osu.Game.Resources.Localisation.BreakInfo"; + + /// + /// "Current Progress" + /// + public static LocalisableString CurrentProgressTitle => new TranslatableString(getKey(@"current_progress_title"), @"Current Progress"); + + /// + /// "Grade" + /// + public static LocalisableString ShowInfoGrade => new TranslatableString(getKey(@"show_info_grade"), @"Grade"); + + private static string getKey(string key) => $@"{prefix}:{key}"; + } +} diff --git a/osu.Game/Localisation/CommonStrings.cs b/osu.Game/Localisation/CommonStrings.cs index 9009785f1c..c8630f9332 100644 --- a/osu.Game/Localisation/CommonStrings.cs +++ b/osu.Game/Localisation/CommonStrings.cs @@ -194,6 +194,11 @@ namespace osu.Game.Localisation /// public static LocalisableString Details => new TranslatableString(getKey(@"details"), @"Details..."); + /// + /// "Mapper" + /// + public static LocalisableString Mapper => new TranslatableString(getKey(@"mapper"), @"Mapper"); + private static string getKey(string key) => $@"{prefix}:{key}"; } } diff --git a/osu.Game/Localisation/PlayerSettingsOverlayStrings.cs b/osu.Game/Localisation/PlayerSettingsOverlayStrings.cs index 60874da561..d659f950dc 100644 --- a/osu.Game/Localisation/PlayerSettingsOverlayStrings.cs +++ b/osu.Game/Localisation/PlayerSettingsOverlayStrings.cs @@ -29,6 +29,61 @@ namespace osu.Game.Localisation /// public static LocalisableString SeekForwardSeconds(double arg0) => new TranslatableString(getKey(@"seek_forward_seconds"), @"Seek forward {0} seconds", arg0); + /// + /// "Playback speed" + /// + public static LocalisableString PlaybackSpeed => new TranslatableString(getKey(@"playback_speed"), @"Playback speed"); + + /// + /// "Show click markers" + /// + public static LocalisableString ShowClickMarkers => new TranslatableString(getKey(@"show_click_markers"), @"Show click markers"); + + /// + /// "Show frame markers" + /// + public static LocalisableString ShowFrameMarkers => new TranslatableString(getKey(@"show_frame_markers"), @"Show frame markers"); + + /// + /// "Show cursor path" + /// + public static LocalisableString ShowCursorPath => new TranslatableString(getKey(@"show_cursor_path"), @"Show cursor path"); + + /// + /// "Hide gameplay cursor" + /// + public static LocalisableString HideGameplayCursor => new TranslatableString(getKey(@"hide_gameplay_cursor"), @"Hide gameplay cursor"); + + /// + /// "Display length" + /// + public static LocalisableString DisplayLength => new TranslatableString(getKey(@"display_length"), @"Display length"); + + /// + /// "Playback" + /// + public static LocalisableString PlaybackTitle => new TranslatableString(getKey(@"playback_title"), @"Playback"); + + /// + /// "Visual Settings" + /// + public static LocalisableString VisualSettingsTitle => new TranslatableString(getKey(@"visual_settings_title"), @"Visual Settings"); + + /// + /// "Audio Settings" + /// + public static LocalisableString AudioSettingsTitle => new TranslatableString(getKey(@"audio_settings_title"), @"Audio Settings"); + + /// + /// "Input Settings" + /// + public static LocalisableString InputSettingsTitle => new TranslatableString(getKey(@"input_settings_title"), @"Input Settings"); + + /// + /// "Analysis Settings" + /// + public static LocalisableString AnalysisSettingsTitle => new TranslatableString(getKey(@"analysis_settings_title"), @"Analysis Settings"); + private static string getKey(string key) => $@"{prefix}:{key}"; } } diff --git a/osu.Game/Overlays/SettingsToolboxGroup.cs b/osu.Game/Overlays/SettingsToolboxGroup.cs index b1a0ca0ccd..d82118fa1a 100644 --- a/osu.Game/Overlays/SettingsToolboxGroup.cs +++ b/osu.Game/Overlays/SettingsToolboxGroup.cs @@ -3,12 +3,14 @@ using osu.Framework.Allocation; using osu.Framework.Bindables; +using osu.Framework.Extensions.LocalisationExtensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Sprites; using osu.Framework.Input; using osu.Framework.Input.Events; +using osu.Framework.Localisation; using osu.Framework.Utils; using osu.Game.Graphics; using osu.Game.Graphics.Containers; @@ -21,7 +23,7 @@ namespace osu.Game.Overlays { public partial class SettingsToolboxGroup : Container, IExpandable { - private readonly string title; + private readonly LocalisableString title; public const int CONTAINER_WIDTH = 270; private const float transition_duration = 250; @@ -60,7 +62,7 @@ namespace osu.Game.Overlays /// Create a new instance. /// /// The title to be displayed in the header of this group. - public SettingsToolboxGroup(string title) + public SettingsToolboxGroup(LocalisableString title) { this.title = title; @@ -102,7 +104,7 @@ namespace osu.Game.Overlays { Origin = Anchor.CentreLeft, Anchor = Anchor.CentreLeft, - Text = title.ToUpperInvariant(), + Text = title.ToUpper(), Font = OsuFont.GetFont(weight: FontWeight.Bold, size: 17), Padding = new MarginPadding { Left = 10, Right = 30 }, }, diff --git a/osu.Game/Screens/Play/BeatmapMetadataDisplay.cs b/osu.Game/Screens/Play/BeatmapMetadataDisplay.cs index 08ea0d0a90..23264c4518 100644 --- a/osu.Game/Screens/Play/BeatmapMetadataDisplay.cs +++ b/osu.Game/Screens/Play/BeatmapMetadataDisplay.cs @@ -19,6 +19,7 @@ using osu.Game.Resources.Localisation.Web; using osu.Game.Rulesets.Mods; using osu.Game.Screens.Play.HUD; using osuTK; +using CommonStrings = osu.Game.Localisation.CommonStrings; namespace osu.Game.Screens.Play { @@ -165,7 +166,7 @@ namespace osu.Game.Screens.Play }, new Drawable[] { - new MetadataLineLabel("Mapper"), + new MetadataLineLabel(CommonStrings.Mapper), new MetadataLineInfo(metadata.Author.Username) } } diff --git a/osu.Game/Screens/Play/Break/BreakInfo.cs b/osu.Game/Screens/Play/Break/BreakInfo.cs index ef453405b5..28c38dce2b 100644 --- a/osu.Game/Screens/Play/Break/BreakInfo.cs +++ b/osu.Game/Screens/Play/Break/BreakInfo.cs @@ -1,10 +1,12 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +using osu.Framework.Extensions.LocalisationExtensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Game.Graphics; using osu.Game.Graphics.Sprites; +using osu.Game.Localisation; using osu.Game.Resources.Localisation.Web; using osu.Game.Scoring; using osuTK; @@ -32,7 +34,7 @@ namespace osu.Game.Screens.Play.Break { Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, - Text = "current progress".ToUpperInvariant(), + Text = BreakInfoStrings.CurrentProgressTitle.ToUpper(), Font = OsuFont.GetFont(weight: FontWeight.Bold, size: 15), }, new FillFlowContainer @@ -46,7 +48,7 @@ namespace osu.Game.Screens.Play.Break AccuracyDisplay = new PercentageBreakInfoLine(BeatmapsetsStrings.ShowScoreboardHeadersAccuracy), // See https://github.com/ppy/osu/discussions/15185 // RankDisplay = new BreakInfoLine("Rank"), - GradeDisplay = new BreakInfoLine("Grade"), + GradeDisplay = new BreakInfoLine(BreakInfoStrings.ShowInfoGrade), }, } }, diff --git a/osu.Game/Screens/Play/PlayerSettings/AudioSettings.cs b/osu.Game/Screens/Play/PlayerSettings/AudioSettings.cs index 3c79721590..9ff90f6fef 100644 --- a/osu.Game/Screens/Play/PlayerSettings/AudioSettings.cs +++ b/osu.Game/Screens/Play/PlayerSettings/AudioSettings.cs @@ -19,7 +19,7 @@ namespace osu.Game.Screens.Play.PlayerSettings private readonly PlayerCheckbox beatmapHitsoundsToggle; public AudioSettings() - : base("Audio Settings") + : base(PlayerSettingsOverlayStrings.AudioSettingsTitle) { Children = new Drawable[] { diff --git a/osu.Game/Screens/Play/PlayerSettings/InputSettings.cs b/osu.Game/Screens/Play/PlayerSettings/InputSettings.cs index 1387e01305..9c9f31e903 100644 --- a/osu.Game/Screens/Play/PlayerSettings/InputSettings.cs +++ b/osu.Game/Screens/Play/PlayerSettings/InputSettings.cs @@ -12,7 +12,7 @@ namespace osu.Game.Screens.Play.PlayerSettings public partial class InputSettings : PlayerSettingsGroup { public InputSettings() - : base("Input Settings") + : base(PlayerSettingsOverlayStrings.InputSettingsTitle) { } diff --git a/osu.Game/Screens/Play/PlayerSettings/PlaybackSettings.cs b/osu.Game/Screens/Play/PlayerSettings/PlaybackSettings.cs index b3d07421ed..be84d498fa 100644 --- a/osu.Game/Screens/Play/PlayerSettings/PlaybackSettings.cs +++ b/osu.Game/Screens/Play/PlayerSettings/PlaybackSettings.cs @@ -41,7 +41,7 @@ namespace osu.Game.Screens.Play.PlayerSettings private IconButton pausePlay = null!; public PlaybackSettings() - : base("playback") + : base(PlayerSettingsOverlayStrings.PlaybackTitle) { } @@ -138,7 +138,7 @@ namespace osu.Game.Screens.Play.PlayerSettings { rateSlider = new PlayerSliderBar { - LabelText = "Playback speed", + LabelText = PlayerSettingsOverlayStrings.PlaybackSpeed, Current = UserPlaybackRate, }, multiplierText = new OsuSpriteText diff --git a/osu.Game/Screens/Play/PlayerSettings/PlayerSettingsGroup.cs b/osu.Game/Screens/Play/PlayerSettings/PlayerSettingsGroup.cs index 838106e198..0f9a00dfd2 100644 --- a/osu.Game/Screens/Play/PlayerSettings/PlayerSettingsGroup.cs +++ b/osu.Game/Screens/Play/PlayerSettings/PlayerSettingsGroup.cs @@ -2,13 +2,14 @@ // See the LICENCE file in the repository root for full licence text. using osu.Framework.Input.Events; +using osu.Framework.Localisation; using osu.Game.Overlays; namespace osu.Game.Screens.Play.PlayerSettings { public partial class PlayerSettingsGroup : SettingsToolboxGroup { - public PlayerSettingsGroup(string title) + public PlayerSettingsGroup(LocalisableString title) : base(title) { } diff --git a/osu.Game/Screens/Play/PlayerSettings/VisualSettings.cs b/osu.Game/Screens/Play/PlayerSettings/VisualSettings.cs index ff857ddb12..6a09e627c1 100644 --- a/osu.Game/Screens/Play/PlayerSettings/VisualSettings.cs +++ b/osu.Game/Screens/Play/PlayerSettings/VisualSettings.cs @@ -18,7 +18,7 @@ namespace osu.Game.Screens.Play.PlayerSettings private readonly PlayerCheckbox beatmapColorsToggle; public VisualSettings() - : base("Visual Settings") + : base(PlayerSettingsOverlayStrings.VisualSettingsTitle) { Children = new Drawable[] {