diff --git a/osu.Game/Localisation/RankingStatisticsStrings.cs b/osu.Game/Localisation/RankingStatisticsStrings.cs
index e6bd8bdc49..5d26390c79 100644
--- a/osu.Game/Localisation/RankingStatisticsStrings.cs
+++ b/osu.Game/Localisation/RankingStatisticsStrings.cs
@@ -20,14 +20,14 @@ namespace osu.Game.Localisation
public static LocalisableString UnstableRateTitle => new TranslatableString(getKey(@"unstable_rate_title"), @"Unstable Rate");
///
- /// "early"
+ /// "{0} ms early"
///
- public static LocalisableString Early => new TranslatableString(getKey(@"early"), @"early");
+ public static LocalisableString Early(string offset) => new TranslatableString(getKey(@"early"), @"{0} ms early", offset);
///
- /// "late"
+ /// "{0} ms late"
///
- public static LocalisableString Late => new TranslatableString(getKey(@"late"), @"late");
+ public static LocalisableString Late(string offset) => new TranslatableString(getKey(@"late"), @"{0} ms late", offset);
///
/// "(not available)"
diff --git a/osu.Game/Screens/Ranking/Statistics/AverageHitError.cs b/osu.Game/Screens/Ranking/Statistics/AverageHitError.cs
index 2670a68f03..1d20479e18 100644
--- a/osu.Game/Screens/Ranking/Statistics/AverageHitError.cs
+++ b/osu.Game/Screens/Ranking/Statistics/AverageHitError.cs
@@ -24,8 +24,14 @@ namespace osu.Game.Screens.Ranking.Statistics
Value = hitEvents.CalculateAverageHitError();
}
- protected override LocalisableString DisplayValue(double? value) => value == null
- ? RankingStatisticsStrings.NotAvailable
- : $"{Math.Abs(value.Value):N2} ms {(value.Value < 0 ? RankingStatisticsStrings.Early : RankingStatisticsStrings.Late)}";
+ protected override LocalisableString DisplayValue(double? value)
+ {
+ return value == null ? RankingStatisticsStrings.NotAvailable : getEarlyLateText(value.Value);
+
+ LocalisableString getEarlyLateText(double offset) =>
+ offset < 0
+ ? RankingStatisticsStrings.Early(Math.Abs(offset).ToString(@"N2"))
+ : RankingStatisticsStrings.Late(Math.Abs(offset).ToString(@"N2"));
+ }
}
}
diff --git a/osu.Game/Screens/Ranking/Statistics/SimpleStatisticItem.cs b/osu.Game/Screens/Ranking/Statistics/SimpleStatisticItem.cs
index 7acb1573c3..f56b09cfc0 100644
--- a/osu.Game/Screens/Ranking/Statistics/SimpleStatisticItem.cs
+++ b/osu.Game/Screens/Ranking/Statistics/SimpleStatisticItem.cs
@@ -1,6 +1,8 @@
// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
+using System;
+using osu.Framework.Extensions.LocalisationExtensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Localisation;
@@ -92,7 +94,13 @@ namespace osu.Game.Screens.Ranking.Statistics
/// Used to convert to a text representation.
/// Defaults to using .
///
- protected virtual LocalisableString DisplayValue(TValue value) => value!.ToString() ?? string.Empty;
+ protected virtual LocalisableString DisplayValue(TValue value)
+ {
+ if (value is IFormattable formattable)
+ return formattable.ToLocalisableString();
+
+ return value!.ToString() ?? string.Empty;
+ }
public SimpleStatisticItem(LocalisableString name)
: base(name)
diff --git a/osu.Game/Screens/Ranking/Statistics/UnstableRate.cs b/osu.Game/Screens/Ranking/Statistics/UnstableRate.cs
index 0aaf7fd063..3cdc29e268 100644
--- a/osu.Game/Screens/Ranking/Statistics/UnstableRate.cs
+++ b/osu.Game/Screens/Ranking/Statistics/UnstableRate.cs
@@ -2,6 +2,7 @@
// See the LICENCE file in the repository root for full licence text.
using System.Collections.Generic;
+using osu.Framework.Extensions.LocalisationExtensions;
using osu.Framework.Localisation;
using osu.Game.Localisation;
using osu.Game.Rulesets.Scoring;
@@ -23,6 +24,6 @@ namespace osu.Game.Screens.Ranking.Statistics
Value = hitEvents.CalculateUnstableRate()?.Result;
}
- protected override LocalisableString DisplayValue(double? value) => value?.ToString(@"N2") ?? RankingStatisticsStrings.NotAvailable;
+ protected override LocalisableString DisplayValue(double? value) => value?.ToLocalisableString(@"N2") ?? RankingStatisticsStrings.NotAvailable;
}
}