Use existing web localisation for most hardcoded strings

This commit is contained in:
Joseph Madamba
2022-01-27 20:53:48 -08:00
parent fb5fcdd083
commit 5e5c8e78a6
70 changed files with 224 additions and 147 deletions

View File

@ -6,6 +6,7 @@ using osu.Framework.Localisation;
using osu.Game.Graphics;
using osu.Game.Graphics.Sprites;
using osu.Game.Graphics.UserInterface;
using osu.Game.Resources.Localisation.Web;
using osu.Game.Screens.Ranking.Expanded.Accuracy;
using osu.Game.Utils;
using osuTK;
@ -26,7 +27,7 @@ namespace osu.Game.Screens.Ranking.Expanded.Statistics
/// </summary>
/// <param name="accuracy">The accuracy to display.</param>
public AccuracyStatistic(double accuracy)
: base("accuracy")
: base(BeatmapsetsStrings.ShowScoreboardHeadersAccuracy)
{
this.accuracy = accuracy;
}

View File

@ -7,6 +7,7 @@ using osu.Framework.Graphics.Colour;
using osu.Framework.Graphics.Containers;
using osu.Game.Graphics;
using osu.Game.Graphics.Sprites;
using osu.Game.Resources.Localisation.Web;
using osu.Game.Screens.Ranking.Expanded.Accuracy;
using osuTK;
@ -27,7 +28,7 @@ namespace osu.Game.Screens.Ranking.Expanded.Statistics
/// <param name="combo">The combo to be displayed.</param>
/// <param name="maxCombo">The maximum value of <paramref name="combo"/>.</param>
public ComboStatistic(int combo, int? maxCombo)
: base("combo", combo, maxCombo)
: base(BeatmapsetsStrings.ShowScoreboardHeadersCombo, combo, maxCombo)
{
isPerfect = combo == maxCombo;
}

View File

@ -3,6 +3,7 @@
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Localisation;
using osu.Game.Graphics;
using osu.Game.Graphics.Sprites;
using osu.Game.Graphics.UserInterface;
@ -26,7 +27,7 @@ namespace osu.Game.Screens.Ranking.Expanded.Statistics
/// <param name="header">The name of the statistic.</param>
/// <param name="count">The value to display.</param>
/// <param name="maxCount">The maximum value of <paramref name="count"/>. Not displayed if null.</param>
public CounterStatistic(string header, int count, int? maxCount = null)
public CounterStatistic(LocalisableString header, int count, int? maxCount = null)
: base(header)
{
this.count = count;

View File

@ -8,6 +8,7 @@ using osu.Framework.Bindables;
using osu.Framework.Extensions;
using osu.Framework.Graphics;
using osu.Game.Graphics.UserInterface;
using osu.Game.Resources.Localisation.Web;
using osu.Game.Scoring;
namespace osu.Game.Screens.Ranking.Expanded.Statistics
@ -23,7 +24,7 @@ namespace osu.Game.Screens.Ranking.Expanded.Statistics
private RollingCounter<int> counter;
public PerformanceStatistic(ScoreInfo score)
: base("PP")
: base(BeatmapsetsStrings.ShowScoreboardHeaderspp)
{
this.score = score;
}

View File

@ -3,10 +3,12 @@
using osu.Framework.Allocation;
using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Extensions.LocalisationExtensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Localisation;
using osu.Game.Graphics;
using osu.Game.Graphics.Sprites;
@ -19,14 +21,14 @@ namespace osu.Game.Screens.Ranking.Expanded.Statistics
{
protected SpriteText HeaderText { get; private set; }
private readonly string header;
private readonly LocalisableString header;
private Drawable content;
/// <summary>
/// Creates a new <see cref="StatisticDisplay"/>.
/// </summary>
/// <param name="header">The name of the statistic.</param>
protected StatisticDisplay(string header)
protected StatisticDisplay(LocalisableString header)
{
this.header = header;
RelativeSizeAxes = Axes.X;
@ -60,7 +62,7 @@ namespace osu.Game.Screens.Ranking.Expanded.Statistics
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Font = OsuFont.Torus.With(size: 12, weight: FontWeight.SemiBold),
Text = header.ToUpperInvariant(),
Text = header.ToUpper(),
}
}
},