From 59fa46bbdd6933f304521d298ef61720d3ed8929 Mon Sep 17 00:00:00 2001 From: Bastian Pedersen Date: Sun, 25 Jun 2023 21:02:41 +0200 Subject: [PATCH 1/3] Create localisation string class for multiplayer countdown buttons --- .../MultiplayerCountdownButtonStrings.cs | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 osu.Game/Localisation/MultiplayerCountdownButtonStrings.cs diff --git a/osu.Game/Localisation/MultiplayerCountdownButtonStrings.cs b/osu.Game/Localisation/MultiplayerCountdownButtonStrings.cs new file mode 100644 index 0000000000..926b15386a --- /dev/null +++ b/osu.Game/Localisation/MultiplayerCountdownButtonStrings.cs @@ -0,0 +1,29 @@ +// 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 static class MultiplayerCountdownButtonStrings + { + private const string prefix = @"osu.Game.Resources.Localisation.MultiplayerCountdownButton"; + + /// + /// "Stop countdown" + /// + public static LocalisableString StopCountdown => new TranslatableString(getKey(@"stop_countdown"), @"Stop countdown"); + + /// + /// "Countdown settings" + /// + public static LocalisableString CountdownSettings => new TranslatableString(getKey(@"countdown_settings"), @"Countdown settings"); + + /// + /// "Start match in {0} minute/seconds" + /// + public static LocalisableString StartMatchInTime(string humanReadableTime) => new TranslatableString(getKey(@"start_match_in"), @"Start match in {0}", humanReadableTime); + + private static string getKey(string key) => $@"{prefix}:{key}"; + } +} From a7153478d6e9c143cbe203a26bfeb24b0ffd47ca Mon Sep 17 00:00:00 2001 From: Bastian Pedersen Date: Sun, 25 Jun 2023 21:03:07 +0200 Subject: [PATCH 2/3] Use newly create localised strings for buttons --- .../Multiplayer/Match/MultiplayerCountdownButton.cs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/osu.Game/Screens/OnlinePlay/Multiplayer/Match/MultiplayerCountdownButton.cs b/osu.Game/Screens/OnlinePlay/Multiplayer/Match/MultiplayerCountdownButton.cs index 6dc343f00a..72c3a8122d 100644 --- a/osu.Game/Screens/OnlinePlay/Multiplayer/Match/MultiplayerCountdownButton.cs +++ b/osu.Game/Screens/OnlinePlay/Multiplayer/Match/MultiplayerCountdownButton.cs @@ -17,6 +17,7 @@ using osu.Framework.Graphics.UserInterface; using osu.Game.Graphics; using osu.Game.Graphics.UserInterface; using osu.Game.Graphics.UserInterfaceV2; +using osu.Game.Localisation; using osu.Game.Online.Multiplayer; using osuTK; @@ -56,7 +57,7 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer.Match base.Action = this.ShowPopover; - TooltipText = "Countdown settings"; + TooltipText = MultiplayerCountdownButtonStrings.CountdownSettings; } [BackgroundDependencyLoader] @@ -112,7 +113,7 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer.Match flow.Add(new RoundedButton { RelativeSizeAxes = Axes.X, - Text = $"Start match in {duration.Humanize()}", + Text = MultiplayerCountdownButtonStrings.StartMatchInTime(duration.Humanize()), BackgroundColour = colours.Green, Action = () => { @@ -127,7 +128,7 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer.Match flow.Add(new RoundedButton { RelativeSizeAxes = Axes.X, - Text = "Stop countdown", + Text = MultiplayerCountdownButtonStrings.StopCountdown, BackgroundColour = colours.Red, Action = () => { From b240ce295b76c91ee6c2c2839ab2173e16eea75c Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 26 Jun 2023 13:38:34 +0900 Subject: [PATCH 3/3] Rename class and key to better match expectations --- ...untdownButtonStrings.cs => MultiplayerMatchStrings.cs} | 8 ++++---- .../Multiplayer/Match/MultiplayerCountdownButton.cs | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) rename osu.Game/Localisation/{MultiplayerCountdownButtonStrings.cs => MultiplayerMatchStrings.cs} (72%) diff --git a/osu.Game/Localisation/MultiplayerCountdownButtonStrings.cs b/osu.Game/Localisation/MultiplayerMatchStrings.cs similarity index 72% rename from osu.Game/Localisation/MultiplayerCountdownButtonStrings.cs rename to osu.Game/Localisation/MultiplayerMatchStrings.cs index 926b15386a..95c7168a09 100644 --- a/osu.Game/Localisation/MultiplayerCountdownButtonStrings.cs +++ b/osu.Game/Localisation/MultiplayerMatchStrings.cs @@ -5,9 +5,9 @@ using osu.Framework.Localisation; namespace osu.Game.Localisation { - public static class MultiplayerCountdownButtonStrings + public static class MultiplayerMatchStrings { - private const string prefix = @"osu.Game.Resources.Localisation.MultiplayerCountdownButton"; + private const string prefix = @"osu.Game.Resources.Localisation.MultiplayerMatchStrings"; /// /// "Stop countdown" @@ -20,9 +20,9 @@ namespace osu.Game.Localisation public static LocalisableString CountdownSettings => new TranslatableString(getKey(@"countdown_settings"), @"Countdown settings"); /// - /// "Start match in {0} minute/seconds" + /// "Start match in {0}" /// - public static LocalisableString StartMatchInTime(string humanReadableTime) => new TranslatableString(getKey(@"start_match_in"), @"Start match in {0}", humanReadableTime); + public static LocalisableString StartMatchWithCountdown(string humanReadableTime) => new TranslatableString(getKey(@"start_match_width_countdown"), @"Start match in {0}", humanReadableTime); private static string getKey(string key) => $@"{prefix}:{key}"; } diff --git a/osu.Game/Screens/OnlinePlay/Multiplayer/Match/MultiplayerCountdownButton.cs b/osu.Game/Screens/OnlinePlay/Multiplayer/Match/MultiplayerCountdownButton.cs index 72c3a8122d..e1543eaceb 100644 --- a/osu.Game/Screens/OnlinePlay/Multiplayer/Match/MultiplayerCountdownButton.cs +++ b/osu.Game/Screens/OnlinePlay/Multiplayer/Match/MultiplayerCountdownButton.cs @@ -57,7 +57,7 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer.Match base.Action = this.ShowPopover; - TooltipText = MultiplayerCountdownButtonStrings.CountdownSettings; + TooltipText = MultiplayerMatchStrings.CountdownSettings; } [BackgroundDependencyLoader] @@ -113,7 +113,7 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer.Match flow.Add(new RoundedButton { RelativeSizeAxes = Axes.X, - Text = MultiplayerCountdownButtonStrings.StartMatchInTime(duration.Humanize()), + Text = MultiplayerMatchStrings.StartMatchWithCountdown(duration.Humanize()), BackgroundColour = colours.Green, Action = () => { @@ -128,7 +128,7 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer.Match flow.Add(new RoundedButton { RelativeSizeAxes = Axes.X, - Text = MultiplayerCountdownButtonStrings.StopCountdown, + Text = MultiplayerMatchStrings.StopCountdown, BackgroundColour = colours.Red, Action = () => {