From 545cfc7bf1e2b84304e28caf381e200dcb10d59f Mon Sep 17 00:00:00 2001 From: Joseph Madamba Date: Sun, 10 Oct 2021 19:35:25 -0700 Subject: [PATCH] Localise tracked setting toasts --- osu.Game/Configuration/OsuConfigManager.cs | 10 ++++++---- osu.Game/Overlays/OSD/Toast.cs | 8 +++++--- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/osu.Game/Configuration/OsuConfigManager.cs b/osu.Game/Configuration/OsuConfigManager.cs index 9b0d7f51da..05a18ef88a 100644 --- a/osu.Game/Configuration/OsuConfigManager.cs +++ b/osu.Game/Configuration/OsuConfigManager.cs @@ -6,10 +6,12 @@ using System.Diagnostics; using osu.Framework.Configuration; using osu.Framework.Configuration.Tracking; using osu.Framework.Extensions; +using osu.Framework.Extensions.LocalisationExtensions; using osu.Framework.Platform; using osu.Framework.Testing; using osu.Game.Input; using osu.Game.Input.Bindings; +using osu.Game.Localisation; using osu.Game.Overlays; using osu.Game.Rulesets.Scoring; using osu.Game.Screens.Select; @@ -185,13 +187,13 @@ namespace osu.Game.Configuration return new TrackedSettings { - new TrackedSetting(OsuSetting.MouseDisableButtons, v => new SettingDescription(!v, "gameplay mouse buttons", v ? "disabled" : "enabled", LookupKeyBindings(GlobalAction.ToggleGameplayMouseButtons))), - new TrackedSetting(OsuSetting.HUDVisibilityMode, m => new SettingDescription(m, "HUD Visibility", m.GetDescription(), $"cycle: {LookupKeyBindings(GlobalAction.ToggleInGameInterface)} quick view: {LookupKeyBindings(GlobalAction.HoldForHUD)}")), - new TrackedSetting(OsuSetting.Scaling, m => new SettingDescription(m, "scaling", m.GetDescription())), + new TrackedSetting(OsuSetting.MouseDisableButtons, v => new SettingDescription(!v, GlobalActionKeyBindingStrings.ToggleGameplayMouseButtons, v ? CommonStrings.Disabled.ToLower() : CommonStrings.Enabled.ToLower(), LookupKeyBindings(GlobalAction.ToggleGameplayMouseButtons))), + new TrackedSetting(OsuSetting.HUDVisibilityMode, m => new SettingDescription(m, GameplaySettingsStrings.HUDVisibilityMode, m.GetLocalisableDescription(), $"{GlobalActionKeyBindingStrings.ToggleInGameInterface}: {LookupKeyBindings(GlobalAction.ToggleInGameInterface)} {GlobalActionKeyBindingStrings.HoldForHUD}: {LookupKeyBindings(GlobalAction.HoldForHUD)}")), + new TrackedSetting(OsuSetting.Scaling, m => new SettingDescription(m, GraphicsSettingsStrings.ScreenScaling, m.GetLocalisableDescription())), new TrackedSetting(OsuSetting.Skin, m => { string skinName = LookupSkinName(m) ?? string.Empty; - return new SettingDescription(skinName, "skin", skinName, $"random: {LookupKeyBindings(GlobalAction.RandomSkin)}"); + return new SettingDescription(skinName, SkinSettingsStrings.SkinSectionHeader, skinName, $"{GlobalActionKeyBindingStrings.RandomSkin}: {LookupKeyBindings(GlobalAction.RandomSkin)}"); }) }; } diff --git a/osu.Game/Overlays/OSD/Toast.cs b/osu.Game/Overlays/OSD/Toast.cs index 4a6316df3f..4221bb1069 100644 --- a/osu.Game/Overlays/OSD/Toast.cs +++ b/osu.Game/Overlays/OSD/Toast.cs @@ -1,9 +1,11 @@ // 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.Framework.Graphics.Shapes; +using osu.Framework.Localisation; using osu.Game.Graphics; using osu.Game.Graphics.Sprites; using osuTK; @@ -23,7 +25,7 @@ namespace osu.Game.Overlays.OSD protected readonly OsuSpriteText ShortcutText; - protected Toast(string description, string value, string shortcut) + protected Toast(LocalisableString description, LocalisableString value, LocalisableString shortcut) { Anchor = Anchor.Centre; Origin = Anchor.Centre; @@ -60,7 +62,7 @@ namespace osu.Game.Overlays.OSD Spacing = new Vector2(1, 0), Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, - Text = description.ToUpperInvariant() + Text = description.ToUpper() }, ValueText = new OsuSpriteText { @@ -79,7 +81,7 @@ namespace osu.Game.Overlays.OSD Alpha = 0.3f, Margin = new MarginPadding { Bottom = 15 }, Font = OsuFont.GetFont(size: 12, weight: FontWeight.Bold), - Text = string.IsNullOrEmpty(shortcut) ? "NO KEY BOUND" : shortcut.ToUpperInvariant() + Text = string.IsNullOrEmpty(shortcut.ToString()) ? (LocalisableString)"NO KEY BOUND" : shortcut.ToUpper() }, }; }