Localise beatmap section.

This commit is contained in:
Lucas A 2021-07-17 15:45:17 +02:00
parent d36842aa15
commit 5bb45c7f84
5 changed files with 19 additions and 15 deletions

View File

@ -5,6 +5,7 @@ using System.Collections.Generic;
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Bindables; using osu.Framework.Bindables;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Localisation;
using osu.Game.Online.API; using osu.Game.Online.API;
using osu.Game.Online.API.Requests; using osu.Game.Online.API.Requests;
using osu.Game.Online.API.Requests.Responses; using osu.Game.Online.API.Requests.Responses;
@ -19,8 +20,8 @@ namespace osu.Game.Overlays.Profile.Sections.Beatmaps
private const float panel_padding = 10f; private const float panel_padding = 10f;
private readonly BeatmapSetType type; private readonly BeatmapSetType type;
public PaginatedBeatmapContainer(BeatmapSetType type, Bindable<User> user, string headerText) public PaginatedBeatmapContainer(BeatmapSetType type, Bindable<User> user, LocalisableString headerText)
: base(user, headerText) : base(user, headerText, null)
{ {
this.type = type; this.type = type;
ItemsPerPage = 6; ItemsPerPage = 6;

View File

@ -18,11 +18,11 @@ namespace osu.Game.Overlays.Profile.Sections
{ {
Children = new[] Children = new[]
{ {
new PaginatedBeatmapContainer(BeatmapSetType.Favourite, User, "Favourite Beatmaps"), new PaginatedBeatmapContainer(BeatmapSetType.Favourite, User, UsersStrings.ShowExtraBeatmapsFavouriteTitle),
new PaginatedBeatmapContainer(BeatmapSetType.RankedAndApproved, User, "Ranked & Approved Beatmaps"), new PaginatedBeatmapContainer(BeatmapSetType.RankedAndApproved, User, UsersStrings.ShowExtraBeatmapsRankedTitle),
new PaginatedBeatmapContainer(BeatmapSetType.Loved, User, "Loved Beatmaps"), new PaginatedBeatmapContainer(BeatmapSetType.Loved, User, UsersStrings.ShowExtraBeatmapsLovedTitle),
new PaginatedBeatmapContainer(BeatmapSetType.Unranked, User, "Pending Beatmaps"), new PaginatedBeatmapContainer(BeatmapSetType.Unranked, User, UsersStrings.ShowExtraBeatmapsPendingTitle),
new PaginatedBeatmapContainer(BeatmapSetType.Graveyard, User, "Graveyarded Beatmaps") new PaginatedBeatmapContainer(BeatmapSetType.Graveyard, User, UsersStrings.ShowExtraBeatmapsGraveyardTitle)
}; };
} }
} }

View File

@ -15,6 +15,7 @@ using osu.Game.Graphics.UserInterface;
using osu.Game.Rulesets; using osu.Game.Rulesets;
using osu.Game.Graphics.Sprites; using osu.Game.Graphics.Sprites;
using osu.Game.Graphics; using osu.Game.Graphics;
using osu.Framework.Localisation;
namespace osu.Game.Overlays.Profile.Sections namespace osu.Game.Overlays.Profile.Sections
{ {
@ -36,9 +37,9 @@ namespace osu.Game.Overlays.Profile.Sections
private ShowMoreButton moreButton; private ShowMoreButton moreButton;
private OsuSpriteText missing; private OsuSpriteText missing;
private readonly string missingText; private readonly LocalisableString? missingText;
protected PaginatedProfileSubsection(Bindable<User> user, string headerText = "", string missingText = "") protected PaginatedProfileSubsection(Bindable<User> user, LocalisableString headerText, LocalisableString? missingText)
: base(user, headerText, CounterVisibilityState.AlwaysVisible) : base(user, headerText, CounterVisibilityState.AlwaysVisible)
{ {
this.missingText = missingText; this.missingText = missingText;
@ -68,7 +69,7 @@ namespace osu.Game.Overlays.Profile.Sections
missing = new OsuSpriteText missing = new OsuSpriteText
{ {
Font = OsuFont.GetFont(size: 15), Font = OsuFont.GetFont(size: 15),
Text = missingText, Text = missingText ?? string.Empty,
Alpha = 0, Alpha = 0,
} }
} }
@ -114,7 +115,7 @@ namespace osu.Game.Overlays.Profile.Sections
moreButton.Hide(); moreButton.Hide();
moreButton.IsLoading = false; moreButton.IsLoading = false;
if (!string.IsNullOrEmpty(missingText)) if (missingText.HasValue)
missing.Show(); missing.Show();
return; return;

View File

@ -7,6 +7,7 @@ using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Game.Users; using osu.Game.Users;
using JetBrains.Annotations; using JetBrains.Annotations;
using osu.Framework.Localisation;
namespace osu.Game.Overlays.Profile.Sections namespace osu.Game.Overlays.Profile.Sections
{ {
@ -14,12 +15,12 @@ namespace osu.Game.Overlays.Profile.Sections
{ {
protected readonly Bindable<User> User = new Bindable<User>(); protected readonly Bindable<User> User = new Bindable<User>();
private readonly string headerText; private readonly LocalisableString headerText;
private readonly CounterVisibilityState counterVisibilityState; private readonly CounterVisibilityState counterVisibilityState;
private ProfileSubsectionHeader header; private ProfileSubsectionHeader header;
protected ProfileSubsection(Bindable<User> user, string headerText = "", CounterVisibilityState counterVisibilityState = CounterVisibilityState.AlwaysHidden) protected ProfileSubsection(Bindable<User> user, LocalisableString headerText, CounterVisibilityState counterVisibilityState = CounterVisibilityState.AlwaysHidden)
{ {
this.headerText = headerText; this.headerText = headerText;
this.counterVisibilityState = counterVisibilityState; this.counterVisibilityState = counterVisibilityState;

View File

@ -11,6 +11,7 @@ using osu.Framework.Graphics.Shapes;
using osuTK; using osuTK;
using osu.Game.Graphics.Sprites; using osu.Game.Graphics.Sprites;
using osu.Game.Graphics; using osu.Game.Graphics;
using osu.Framework.Localisation;
namespace osu.Game.Overlays.Profile.Sections namespace osu.Game.Overlays.Profile.Sections
{ {
@ -24,12 +25,12 @@ namespace osu.Game.Overlays.Profile.Sections
set => current.Current = value; set => current.Current = value;
} }
private readonly string text; private readonly LocalisableString text;
private readonly CounterVisibilityState counterState; private readonly CounterVisibilityState counterState;
private CounterPill counterPill; private CounterPill counterPill;
public ProfileSubsectionHeader(string text, CounterVisibilityState counterState) public ProfileSubsectionHeader(LocalisableString text, CounterVisibilityState counterState)
{ {
this.text = text; this.text = text;
this.counterState = counterState; this.counterState = counterState;