1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-28 16:12:57 +08:00

Localise Historical section.

This commit is contained in:
Lucas A 2021-07-17 16:20:37 +02:00
parent 2f3ed4a4ab
commit 148eb890ff
8 changed files with 24 additions and 15 deletions

View File

@ -6,6 +6,7 @@ using System.Linq;
using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Localisation;
using osu.Game.Users;
using static osu.Game.Users.User;
@ -18,9 +19,9 @@ namespace osu.Game.Overlays.Profile.Sections.Historical
/// <summary>
/// Text describing the value being plotted on the graph, which will be displayed as a prefix to the value in the history graph tooltip.
/// </summary>
protected abstract string GraphCounterName { get; }
protected abstract LocalisableString GraphCounterName { get; }
protected ChartProfileSubsection(Bindable<User> user, string headerText)
protected ChartProfileSubsection(Bindable<User> user, LocalisableString headerText)
: base(user, headerText)
{
}

View File

@ -13,6 +13,7 @@ using osu.Game.Graphics.Sprites;
using osuTK;
using osu.Framework.Graphics.Cursor;
using osu.Framework.Localisation;
using osu.Game.Resources.Localisation.Web;
namespace osu.Game.Overlays.Profile.Sections.Historical
{
@ -143,7 +144,7 @@ namespace osu.Game.Overlays.Profile.Sections.Historical
private class PlayCountText : CompositeDrawable, IHasTooltip
{
public LocalisableString TooltipText => "times played";
public LocalisableString TooltipText => UsersStrings.ShowExtraHistoricalMostPlayedCount;
public PlayCountText(int playCount)
{

View File

@ -9,6 +9,7 @@ using osu.Framework.Graphics.Containers;
using osu.Game.Online.API;
using osu.Game.Online.API.Requests;
using osu.Game.Online.API.Requests.Responses;
using osu.Game.Resources.Localisation.Web;
using osu.Game.Users;
namespace osu.Game.Overlays.Profile.Sections.Historical
@ -16,7 +17,7 @@ namespace osu.Game.Overlays.Profile.Sections.Historical
public class PaginatedMostPlayedBeatmapContainer : PaginatedProfileSubsection<APIUserMostPlayedBeatmap>
{
public PaginatedMostPlayedBeatmapContainer(Bindable<User> user)
: base(user, "Most Played Beatmaps")
: base(user, UsersStrings.ShowExtraHistoricalMostPlayedTitle)
{
ItemsPerPage = 5;
}

View File

@ -2,6 +2,8 @@
// See the LICENCE file in the repository root for full licence text.
using osu.Framework.Bindables;
using osu.Framework.Localisation;
using osu.Game.Resources.Localisation.Web;
using osu.Game.Users;
using static osu.Game.Users.User;
@ -9,10 +11,10 @@ namespace osu.Game.Overlays.Profile.Sections.Historical
{
public class PlayHistorySubsection : ChartProfileSubsection
{
protected override string GraphCounterName => "Plays";
protected override LocalisableString GraphCounterName => UsersStrings.ShowExtraHistoricalMonthlyPlaycountsCountLabel;
public PlayHistorySubsection(Bindable<User> user)
: base(user, "Play History")
: base(user, UsersStrings.ShowExtraHistoricalMonthlyPlaycountsTitle)
{
}

View File

@ -13,6 +13,7 @@ using osu.Game.Graphics;
using osu.Framework.Graphics.Shapes;
using osuTK;
using static osu.Game.Users.User;
using osu.Framework.Localisation;
namespace osu.Game.Overlays.Profile.Sections.Historical
{
@ -42,7 +43,7 @@ namespace osu.Game.Overlays.Profile.Sections.Historical
private readonly Container<TickLine> rowLinesContainer;
private readonly Container<TickLine> columnLinesContainer;
public ProfileLineChart(string graphCounterName)
public ProfileLineChart(LocalisableString graphCounterName)
{
RelativeSizeAxes = Axes.X;
Height = 250;

View File

@ -2,6 +2,8 @@
// See the LICENCE file in the repository root for full licence text.
using osu.Framework.Bindables;
using osu.Framework.Localisation;
using osu.Game.Resources.Localisation.Web;
using osu.Game.Users;
using static osu.Game.Users.User;
@ -9,10 +11,10 @@ namespace osu.Game.Overlays.Profile.Sections.Historical
{
public class ReplaysSubsection : ChartProfileSubsection
{
protected override string GraphCounterName => "Replays Watched";
protected override LocalisableString GraphCounterName => UsersStrings.ShowExtraHistoricalReplaysWatchedCountsCountLabel;
public ReplaysSubsection(Bindable<User> user)
: base(user, "Replays Watched History")
: base(user, UsersStrings.ShowExtraHistoricalReplaysWatchedCountsTitle)
{
}

View File

@ -5,13 +5,14 @@ using System;
using System.Collections.Generic;
using System.Linq;
using JetBrains.Annotations;
using osu.Framework.Localisation;
using static osu.Game.Users.User;
namespace osu.Game.Overlays.Profile.Sections.Historical
{
public class UserHistoryGraph : UserGraph<DateTime, long>
{
private readonly string tooltipCounterName;
private readonly LocalisableString tooltipCounterName;
[CanBeNull]
public UserHistoryCount[] Values
@ -19,7 +20,7 @@ namespace osu.Game.Overlays.Profile.Sections.Historical
set => Data = value?.Select(v => new KeyValuePair<DateTime, long>(v.Date, v.Count)).ToArray();
}
public UserHistoryGraph(string tooltipCounterName)
public UserHistoryGraph(LocalisableString tooltipCounterName)
{
this.tooltipCounterName = tooltipCounterName;
}
@ -40,9 +41,9 @@ namespace osu.Game.Overlays.Profile.Sections.Historical
protected class HistoryGraphTooltip : UserGraphTooltip
{
private readonly string tooltipCounterName;
private readonly LocalisableString tooltipCounterName;
public HistoryGraphTooltip(string tooltipCounterName)
public HistoryGraphTooltip(LocalisableString tooltipCounterName)
: base(tooltipCounterName)
{
this.tooltipCounterName = tooltipCounterName;
@ -61,7 +62,7 @@ namespace osu.Game.Overlays.Profile.Sections.Historical
private class TooltipDisplayContent
{
public string Name;
public LocalisableString Name;
public string Count;
public string Date;
}

View File

@ -22,7 +22,7 @@ namespace osu.Game.Overlays.Profile.Sections
{
new PlayHistorySubsection(User),
new PaginatedMostPlayedBeatmapContainer(User),
new PaginatedScoreContainer(ScoreType.Recent, User, "Recent Plays (24h)"),
new PaginatedScoreContainer(ScoreType.Recent, User, UsersStrings.ShowExtraHistoricalRecentPlaysTitle),
new ReplaysSubsection(User)
};
}