mirror of
https://github.com/osukey/osukey.git
synced 2025-05-08 07:07:18 +09:00
Localise OverlayPanelDisplayStyle tab control.
This commit is contained in:
parent
f2287ba022
commit
8da6ecf6a9
@ -1,7 +1,10 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
// 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.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
|
using System;
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
|
using osu.Framework.Localisation;
|
||||||
|
using osu.Game.Resources.Localisation.Web;
|
||||||
|
|
||||||
namespace osu.Game.Overlays.Dashboard.Friends
|
namespace osu.Game.Overlays.Dashboard.Friends
|
||||||
{
|
{
|
||||||
@ -9,6 +12,7 @@ namespace osu.Game.Overlays.Dashboard.Friends
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[LocalisableEnum(typeof(UserSortCriteriaEnumLocalisationMappper))]
|
||||||
public enum UserSortCriteria
|
public enum UserSortCriteria
|
||||||
{
|
{
|
||||||
[Description(@"Recently Active")]
|
[Description(@"Recently Active")]
|
||||||
@ -16,4 +20,25 @@ namespace osu.Game.Overlays.Dashboard.Friends
|
|||||||
Rank,
|
Rank,
|
||||||
Username
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -12,6 +12,9 @@ using osu.Framework.Allocation;
|
|||||||
using osuTK.Graphics;
|
using osuTK.Graphics;
|
||||||
using osu.Framework.Graphics.Cursor;
|
using osu.Framework.Graphics.Cursor;
|
||||||
using osu.Framework.Localisation;
|
using osu.Framework.Localisation;
|
||||||
|
using System;
|
||||||
|
using osu.Game.Resources.Localisation.Web;
|
||||||
|
using osu.Framework.Extensions;
|
||||||
|
|
||||||
namespace osu.Game.Overlays
|
namespace osu.Game.Overlays
|
||||||
{
|
{
|
||||||
@ -57,7 +60,7 @@ namespace osu.Game.Overlays
|
|||||||
[Resolved]
|
[Resolved]
|
||||||
private OverlayColourProvider colourProvider { get; set; }
|
private OverlayColourProvider colourProvider { get; set; }
|
||||||
|
|
||||||
public LocalisableString TooltipText => $@"{Value} view";
|
public LocalisableString TooltipText => Value.GetLocalisableDescription();
|
||||||
|
|
||||||
private readonly SpriteIcon icon;
|
private readonly SpriteIcon icon;
|
||||||
|
|
||||||
@ -98,10 +101,32 @@ namespace osu.Game.Overlays
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[LocalisableEnum(typeof(OverlayPanelDisplayStyleEnumLocalisationMapper))]
|
||||||
public enum OverlayPanelDisplayStyle
|
public enum OverlayPanelDisplayStyle
|
||||||
{
|
{
|
||||||
Card,
|
Card,
|
||||||
List,
|
List,
|
||||||
Brick
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user