1
0
mirror of https://github.com/ppy/osu.git synced 2025-03-15 22:37:21 +08:00

Localise ProfileHeader

This commit is contained in:
Lucas A 2021-07-17 14:46:14 +02:00
parent 8dc9ab9e76
commit e6b8307b8e

View File

@ -7,12 +7,14 @@ using osu.Framework.Graphics;
using osu.Framework.Graphics.Colour;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
using osu.Framework.Localisation;
using osu.Game.Overlays.Profile.Header;
using osu.Game.Resources.Localisation.Web;
using osu.Game.Users;
namespace osu.Game.Overlays.Profile
{
public class ProfileHeader : TabControlOverlayHeader<string>
public class ProfileHeader : TabControlOverlayHeader<ProfileHeaderTab>
{
private UserCoverBackground coverContainer;
@ -27,8 +29,6 @@ namespace osu.Game.Overlays.Profile
User.ValueChanged += e => updateDisplay(e.NewValue);
TabControl.AddItem("info");
TabControl.AddItem("modding");
centreHeaderContainer.DetailsVisible.BindValueChanged(visible => detailHeaderContainer.Expanded = visible.NewValue, true);
}
@ -96,7 +96,7 @@ namespace osu.Game.Overlays.Profile
{
public ProfileHeaderTitle()
{
Title = "player info";
Title = PageTitleStrings.MainUsersControllerDefault;
IconTexture = "Icons/Hexacons/profile";
}
}
@ -106,4 +106,29 @@ namespace osu.Game.Overlays.Profile
protected override double LoadDelay => 0;
}
}
[LocalisableEnum(typeof(ProfileHeaderTabEnumLocalisationMapper))]
public enum ProfileHeaderTab
{
Info,
Modding,
}
public class ProfileHeaderTabEnumLocalisationMapper : EnumLocalisationMapper<ProfileHeaderTab>
{
public override LocalisableString Map(ProfileHeaderTab value)
{
switch (value)
{
case ProfileHeaderTab.Info:
return LayoutStrings.HeaderUsersShow;
case ProfileHeaderTab.Modding:
return LayoutStrings.HeaderUsersModding;
default:
return string.Empty;
}
}
}
}