From ed00cd9fc5b321694e4cf5854448647cd6728b18 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Sat, 30 Oct 2021 18:50:34 +0200 Subject: [PATCH] Remove simple localisable `.ToString()` calls --- osu.Game/Overlays/Changelog/ChangelogSupporterPromo.cs | 2 +- .../Settings/Sections/Maintenance/DirectorySelectScreen.cs | 2 +- osu.Game/Overlays/Settings/SettingsCheckbox.cs | 3 +-- osu.Game/Overlays/Settings/SettingsItem.cs | 4 ++-- .../Screens/OnlinePlay/Lounge/Components/PlaylistCountPill.cs | 3 ++- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/osu.Game/Overlays/Changelog/ChangelogSupporterPromo.cs b/osu.Game/Overlays/Changelog/ChangelogSupporterPromo.cs index 5cc598ae70..e84eee15be 100644 --- a/osu.Game/Overlays/Changelog/ChangelogSupporterPromo.cs +++ b/osu.Game/Overlays/Changelog/ChangelogSupporterPromo.cs @@ -101,7 +101,7 @@ namespace osu.Game.Overlays.Changelog t.Colour = colour.PinkLighter; }) { - Text = ChangelogStrings.SupportText2.ToString(), + Text = ChangelogStrings.SupportText2, Margin = new MarginPadding { Top = 10 }, RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, diff --git a/osu.Game/Overlays/Settings/Sections/Maintenance/DirectorySelectScreen.cs b/osu.Game/Overlays/Settings/Sections/Maintenance/DirectorySelectScreen.cs index e509cac2f1..0814e3c824 100644 --- a/osu.Game/Overlays/Settings/Sections/Maintenance/DirectorySelectScreen.cs +++ b/osu.Game/Overlays/Settings/Sections/Maintenance/DirectorySelectScreen.cs @@ -83,7 +83,7 @@ namespace osu.Game.Overlays.Settings.Sections.Maintenance cp.Font = OsuFont.Default.With(size: 24); }) { - Text = HeaderText.ToString(), + Text = HeaderText, TextAnchor = Anchor.TopCentre, Margin = new MarginPadding(10), RelativeSizeAxes = Axes.X, diff --git a/osu.Game/Overlays/Settings/SettingsCheckbox.cs b/osu.Game/Overlays/Settings/SettingsCheckbox.cs index 8b7ac80a5b..8a8fed4d30 100644 --- a/osu.Game/Overlays/Settings/SettingsCheckbox.cs +++ b/osu.Game/Overlays/Settings/SettingsCheckbox.cs @@ -16,8 +16,7 @@ namespace osu.Game.Overlays.Settings public override LocalisableString LabelText { get => labelText; - // checkbox doesn't properly support localisation yet. - set => ((OsuCheckbox)Control).LabelText = (labelText = value).ToString(); + set => ((OsuCheckbox)Control).LabelText = labelText = value; } } } diff --git a/osu.Game/Overlays/Settings/SettingsItem.cs b/osu.Game/Overlays/Settings/SettingsItem.cs index b593dea576..e709be1343 100644 --- a/osu.Game/Overlays/Settings/SettingsItem.cs +++ b/osu.Game/Overlays/Settings/SettingsItem.cs @@ -68,7 +68,7 @@ namespace osu.Game.Overlays.Settings { set { - bool hasValue = !string.IsNullOrWhiteSpace(value.ToString()); + bool hasValue = value != default; if (warningText == null) { @@ -80,7 +80,7 @@ namespace osu.Game.Overlays.Settings } warningText.Alpha = hasValue ? 1 : 0; - warningText.Text = value.ToString(); // TODO: Remove ToString() call after TextFlowContainer supports localisation (see https://github.com/ppy/osu-framework/issues/4636). + warningText.Text = value ?? default; } } diff --git a/osu.Game/Screens/OnlinePlay/Lounge/Components/PlaylistCountPill.cs b/osu.Game/Screens/OnlinePlay/Lounge/Components/PlaylistCountPill.cs index 2fe3c7b668..ef2c2df4a6 100644 --- a/osu.Game/Screens/OnlinePlay/Lounge/Components/PlaylistCountPill.cs +++ b/osu.Game/Screens/OnlinePlay/Lounge/Components/PlaylistCountPill.cs @@ -4,6 +4,7 @@ using System.Collections.Specialized; using Humanizer; using osu.Framework.Allocation; +using osu.Framework.Extensions.LocalisationExtensions; using osu.Framework.Graphics; using osu.Game.Graphics; using osu.Game.Graphics.Containers; @@ -46,7 +47,7 @@ namespace osu.Game.Screens.OnlinePlay.Lounge.Components private void updateCount(object sender, NotifyCollectionChangedEventArgs e) { count.Clear(); - count.AddText(Playlist.Count.ToString(), s => s.Font = s.Font.With(weight: FontWeight.Bold)); + count.AddText(Playlist.Count.ToLocalisableString(), s => s.Font = s.Font.With(weight: FontWeight.Bold)); count.AddText(" "); count.AddText("Beatmap".ToQuantity(Playlist.Count, ShowQuantityAs.None)); }