1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-14 21:02:55 +08:00

Localise OverlayPanelDisplayStyle tab control.

This commit is contained in:
Lucas A 2021-06-30 21:28:07 +02:00
parent f2287ba022
commit 8da6ecf6a9
2 changed files with 51 additions and 1 deletions

View File

@ -1,7 +1,10 @@
// 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 System.ComponentModel;
using osu.Framework.Localisation;
using osu.Game.Resources.Localisation.Web;
namespace osu.Game.Overlays.Dashboard.Friends
{
@ -9,6 +12,7 @@ namespace osu.Game.Overlays.Dashboard.Friends
{
}
[LocalisableEnum(typeof(UserSortCriteriaEnumLocalisationMappper))]
public enum UserSortCriteria
{
[Description(@"Recently Active")]
@ -16,4 +20,25 @@ namespace osu.Game.Overlays.Dashboard.Friends
Rank,
Username
}
public class UserSortCriteriaEnumLocalisationMappper : EnumLocalisationMapper<UserSortCriteria>
{
public override LocalisableString Map(UserSortCriteria value)
{
switch (value)
{
case UserSortCriteria.LastVisit:
return SortStrings.LastVisit;
case UserSortCriteria.Rank:
return SortStrings.Rank;
case UserSortCriteria.Username:
return SortStrings.Username;
default:
throw new ArgumentOutOfRangeException(nameof(value), value, null);
}
}
}
}

View File

@ -12,6 +12,9 @@ using osu.Framework.Allocation;
using osuTK.Graphics;
using osu.Framework.Graphics.Cursor;
using osu.Framework.Localisation;
using System;
using osu.Game.Resources.Localisation.Web;
using osu.Framework.Extensions;
namespace osu.Game.Overlays
{
@ -57,7 +60,7 @@ namespace osu.Game.Overlays
[Resolved]
private OverlayColourProvider colourProvider { get; set; }
public LocalisableString TooltipText => $@"{Value} view";
public LocalisableString TooltipText => Value.GetLocalisableDescription();
private readonly SpriteIcon icon;
@ -98,10 +101,32 @@ namespace osu.Game.Overlays
}
}
[LocalisableEnum(typeof(OverlayPanelDisplayStyleEnumLocalisationMapper))]
public enum OverlayPanelDisplayStyle
{
Card,
List,
Brick
}
public class OverlayPanelDisplayStyleEnumLocalisationMapper : EnumLocalisationMapper<OverlayPanelDisplayStyle>
{
public override LocalisableString Map(OverlayPanelDisplayStyle value)
{
switch (value)
{
case OverlayPanelDisplayStyle.Card:
return UsersStrings.ViewModeCard;
case OverlayPanelDisplayStyle.List:
return UsersStrings.ViewModeList;
case OverlayPanelDisplayStyle.Brick:
return UsersStrings.ViewModeBrick;
default:
throw new ArgumentOutOfRangeException(nameof(value), value, null);
}
}
}
}