From 032ced5d168075c427c4adf7bc8559f45a0aec02 Mon Sep 17 00:00:00 2001 From: Lucas A Date: Wed, 21 Jul 2021 13:05:01 +0200 Subject: [PATCH 1/2] Localise beatmap explicit content pill. --- osu.Game/Overlays/BeatmapSet/ExplicitContentBeatmapPill.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/osu.Game/Overlays/BeatmapSet/ExplicitContentBeatmapPill.cs b/osu.Game/Overlays/BeatmapSet/ExplicitContentBeatmapPill.cs index 329f8ee0a2..ba78592ed2 100644 --- a/osu.Game/Overlays/BeatmapSet/ExplicitContentBeatmapPill.cs +++ b/osu.Game/Overlays/BeatmapSet/ExplicitContentBeatmapPill.cs @@ -2,11 +2,13 @@ // See the LICENCE file in the repository root for full licence text. using osu.Framework.Allocation; +using osu.Framework.Extensions.LocalisationExtensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; using osu.Game.Graphics; using osu.Game.Graphics.Sprites; +using osu.Game.Resources.Localisation.Web; namespace osu.Game.Overlays.BeatmapSet { @@ -34,7 +36,7 @@ namespace osu.Game.Overlays.BeatmapSet new OsuSpriteText { Margin = new MarginPadding { Horizontal = 10f, Vertical = 2f }, - Text = "EXPLICIT", + Text = BeatmapsetsStrings.NsfwBadgeLabel.ToUpper(), Font = OsuFont.GetFont(size: 10, weight: FontWeight.SemiBold), Colour = OverlayColourProvider.Orange.Colour2, } From ea4f9b2ac772c7fd26d9075210dd5ce0502a26be Mon Sep 17 00:00:00 2001 From: Lucas A Date: Wed, 21 Jul 2021 13:15:07 +0200 Subject: [PATCH 2/2] Localise beatmap online status pill. --- osu.Game/Beatmaps/BeatmapSetOnlineStatus.cs | 41 +++++++++++++++++++ .../Drawables/BeatmapSetOnlineStatusPill.cs | 4 +- 2 files changed, 44 insertions(+), 1 deletion(-) diff --git a/osu.Game/Beatmaps/BeatmapSetOnlineStatus.cs b/osu.Game/Beatmaps/BeatmapSetOnlineStatus.cs index ae5a44cfcd..6003e23a84 100644 --- a/osu.Game/Beatmaps/BeatmapSetOnlineStatus.cs +++ b/osu.Game/Beatmaps/BeatmapSetOnlineStatus.cs @@ -1,8 +1,13 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +using System; +using osu.Framework.Localisation; +using osu.Game.Resources.Localisation.Web; + namespace osu.Game.Beatmaps { + [LocalisableEnum(typeof(BeatmapSetOnlineStatusEnumLocalisationMapper))] public enum BeatmapSetOnlineStatus { None = -3, @@ -20,4 +25,40 @@ namespace osu.Game.Beatmaps public static bool GrantsPerformancePoints(this BeatmapSetOnlineStatus status) => status == BeatmapSetOnlineStatus.Ranked || status == BeatmapSetOnlineStatus.Approved; } + + public class BeatmapSetOnlineStatusEnumLocalisationMapper : EnumLocalisationMapper + { + public override LocalisableString Map(BeatmapSetOnlineStatus value) + { + switch (value) + { + case BeatmapSetOnlineStatus.None: + return string.Empty; + + case BeatmapSetOnlineStatus.Graveyard: + return BeatmapsetsStrings.ShowStatusGraveyard; + + case BeatmapSetOnlineStatus.WIP: + return BeatmapsetsStrings.ShowStatusWip; + + case BeatmapSetOnlineStatus.Pending: + return BeatmapsetsStrings.ShowStatusPending; + + case BeatmapSetOnlineStatus.Ranked: + return BeatmapsetsStrings.ShowStatusRanked; + + case BeatmapSetOnlineStatus.Approved: + return BeatmapsetsStrings.ShowStatusApproved; + + case BeatmapSetOnlineStatus.Qualified: + return BeatmapsetsStrings.ShowStatusQualified; + + case BeatmapSetOnlineStatus.Loved: + return BeatmapsetsStrings.ShowStatusLoved; + + default: + throw new ArgumentOutOfRangeException(nameof(value), value, null); + } + } + } } diff --git a/osu.Game/Beatmaps/Drawables/BeatmapSetOnlineStatusPill.cs b/osu.Game/Beatmaps/Drawables/BeatmapSetOnlineStatusPill.cs index f6e03d40ff..ffc010b3a3 100644 --- a/osu.Game/Beatmaps/Drawables/BeatmapSetOnlineStatusPill.cs +++ b/osu.Game/Beatmaps/Drawables/BeatmapSetOnlineStatusPill.cs @@ -1,6 +1,8 @@ // 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; +using osu.Framework.Extensions.LocalisationExtensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; @@ -28,7 +30,7 @@ namespace osu.Game.Beatmaps.Drawables status = value; Alpha = value == BeatmapSetOnlineStatus.None ? 0 : 1; - statusText.Text = value.ToString().ToUpperInvariant(); + statusText.Text = value.GetLocalisableDescription().ToUpper(); } }