Localise rankings Spotlight selector.

This commit is contained in:
Lucas A
2021-07-30 14:51:16 +02:00
parent 9515a67f57
commit 9717281969

View File

@ -16,6 +16,8 @@ using System.Collections.Generic;
using osu.Framework.Graphics.UserInterface; using osu.Framework.Graphics.UserInterface;
using osu.Game.Online.API.Requests; using osu.Game.Online.API.Requests;
using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Localisation;
using osu.Game.Resources.Localisation.Web;
namespace osu.Game.Overlays.Rankings namespace osu.Game.Overlays.Rankings
{ {
@ -92,10 +94,10 @@ namespace osu.Game.Overlays.Rankings
Margin = new MarginPadding { Bottom = 5 }, Margin = new MarginPadding { Bottom = 5 },
Children = new Drawable[] Children = new Drawable[]
{ {
startDateColumn = new InfoColumn(@"Start Date"), startDateColumn = new InfoColumn(RankingsStrings.SpotlightStartDate),
endDateColumn = new InfoColumn(@"End Date"), endDateColumn = new InfoColumn(RankingsStrings.SpotlightEndDate),
mapCountColumn = new InfoColumn(@"Map Count"), mapCountColumn = new InfoColumn(RankingsStrings.SpotlightMapCount),
participantsColumn = new InfoColumn(@"Participants") participantsColumn = new InfoColumn(RankingsStrings.SpotlightParticipants)
} }
}, },
new RankingsSortTabControl new RankingsSortTabControl
@ -123,21 +125,21 @@ namespace osu.Game.Overlays.Rankings
startDateColumn.Value = dateToString(response.Spotlight.StartDate); startDateColumn.Value = dateToString(response.Spotlight.StartDate);
endDateColumn.Value = dateToString(response.Spotlight.EndDate); endDateColumn.Value = dateToString(response.Spotlight.EndDate);
mapCountColumn.Value = response.BeatmapSets.Count.ToString(); mapCountColumn.Value = response.BeatmapSets.Count.ToString();
participantsColumn.Value = response.Spotlight.Participants?.ToString("N0"); participantsColumn.Value = response.Spotlight.Participants?.ToLocalisableString("N0");
} }
private string dateToString(DateTimeOffset date) => date.ToString("yyyy-MM-dd"); private LocalisableString dateToString(DateTimeOffset date) => date.ToLocalisableString("yyyy-MM-dd");
private class InfoColumn : FillFlowContainer private class InfoColumn : FillFlowContainer
{ {
public string Value public LocalisableString Value
{ {
set => valueText.Text = value; set => valueText.Text = value;
} }
private readonly OsuSpriteText valueText; private readonly OsuSpriteText valueText;
public InfoColumn(string name) public InfoColumn(LocalisableString name)
{ {
AutoSizeAxes = Axes.Both; AutoSizeAxes = Axes.Both;
Direction = FillDirection.Vertical; Direction = FillDirection.Vertical;