1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-22 04:07:25 +08:00

Localise beatmap online status pill.

This commit is contained in:
Lucas A 2021-07-21 13:15:07 +02:00
parent 032ced5d16
commit ea4f9b2ac7
2 changed files with 44 additions and 1 deletions

View File

@ -1,8 +1,13 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. 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<BeatmapSetOnlineStatus>
{
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);
}
}
}
}

View File

@ -1,6 +1,8 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. 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();
}
}