1
0
mirror of https://github.com/ppy/osu.git synced 2026-05-13 19:54:15 +08:00

Add localisation support to DailyChallenge (#37248)

This commit is contained in:
Denis Titovets
2026-05-05 11:25:09 +03:00
committed by GitHub
Unverified
parent 5fb87da37b
commit a72f4495cd
8 changed files with 65 additions and 13 deletions
@@ -24,6 +24,51 @@ Tomorrow's challenge is now being prepared and will appear soon.");
/// </summary>
public static LocalisableString ChallengeLiveNotification => new TranslatableString(getKey(@"todays_daily_challenge_is_now"), @"Today's daily challenge is now live! Click here to play.");
/// <summary>
/// "Today&#39;s Challenge"
/// </summary>
public static LocalisableString TodaysChallenge => new TranslatableString(getKey(@"todays_challenge"), @"Today's Challenge");
/// <summary>
/// "Difficulty: {0}"
/// </summary>
public static LocalisableString DifficultyInfo(string difficultyName) => new TranslatableString(getKey(@"difficulty_info"), @"Difficulty: {0}", difficultyName);
/// <summary>
/// "Time remaining"
/// </summary>
public static LocalisableString SectionTimeRemaining => new TranslatableString(getKey(@"section_time_remaining"), @"Time remaining");
/// <summary>
/// "Score breakdown"
/// </summary>
public static LocalisableString SectionScoreBreakdown => new TranslatableString(getKey(@"section_score_breakdown"), @"Score breakdown");
/// <summary>
/// "Total pass count"
/// </summary>
public static LocalisableString SectionTotalPasses => new TranslatableString(getKey(@"section_total_passes"), @"Total pass count");
/// <summary>
/// "Cumulative total score"
/// </summary>
public static LocalisableString SectionCumulativeScore => new TranslatableString(getKey(@"section_cumulative_score"), @"Cumulative total score");
/// <summary>
/// "Events"
/// </summary>
public static LocalisableString SectionEvents => new TranslatableString(getKey(@"section_events"), @"Events");
/// <summary>
/// "You"
/// </summary>
public static LocalisableString You => new TranslatableString(getKey(@"you"), @"You");
/// <summary>
/// "{0:N0} passes in {1:N0} - {2:N0} range"
/// </summary>
public static LocalisableString ScoreBreakdownBarTooltip(long passesCount, int minScore, int maxScore) => new TranslatableString(getKey(@"score_breakdown_bar_tooltip"), @"{0:N0} passes in {1:N0} - {2:N0} range", passesCount, minScore, maxScore);
private static string getKey(string key) => $@"{prefix}:{key}";
}
}
@@ -322,7 +322,7 @@ namespace osu.Game.Screens.OnlinePlay.DailyChallenge
{
footerButtons.Insert(-1, new UserModSelectButton
{
Text = "Free mods",
Text = OnlinePlayStrings.FooterButtonFreemods,
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
RelativeSizeAxes = Axes.Y,
@@ -11,6 +11,7 @@ using osu.Framework.Utils;
using osu.Game.Graphics;
using osu.Game.Graphics.Containers;
using osu.Game.Graphics.UserInterface;
using osu.Game.Localisation;
using osu.Game.Screens.OnlinePlay.DailyChallenge.Events;
using osu.Game.Users.Drawables;
using osuTK;
@@ -30,7 +31,7 @@ namespace osu.Game.Screens.OnlinePlay.DailyChallenge
{
InternalChildren = new Drawable[]
{
new SectionHeader("Events"),
new SectionHeader(DailyChallengeStrings.SectionEvents),
new Container
{
RelativeSizeAxes = Axes.Both,
@@ -17,9 +17,11 @@ using osu.Game.Beatmaps.Drawables;
using osu.Game.Configuration;
using osu.Game.Graphics;
using osu.Game.Graphics.Sprites;
using osu.Game.Localisation;
using osu.Game.Online;
using osu.Game.Online.Rooms;
using osu.Game.Overlays;
using osu.Game.Resources.Localisation.Web;
using osu.Game.Rulesets;
using osu.Game.Screens.OnlinePlay.Match;
using osu.Game.Screens.Play.HUD;
@@ -145,7 +147,7 @@ namespace osu.Game.Screens.OnlinePlay.DailyChallenge
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Text = "Today's Challenge",
Text = DailyChallengeStrings.TodaysChallenge,
Margin = new MarginPadding { Horizontal = 10f, Vertical = 5f },
Shear = -OsuGame.SHEAR,
Font = OsuFont.GetFont(size: 32, weight: FontWeight.Light, typeface: Typeface.TorusAlternate),
@@ -254,7 +256,7 @@ namespace osu.Game.Screens.OnlinePlay.DailyChallenge
},
new TruncatingSpriteText
{
Text = $"Difficulty: {beatmap.DifficultyName}",
Text = DailyChallengeStrings.DifficultyInfo(beatmap.DifficultyName),
Font = OsuFont.GetFont(size: 20, italics: true),
MaxWidth = horizontal_info_size,
Shear = -OsuGame.SHEAR,
@@ -263,7 +265,7 @@ namespace osu.Game.Screens.OnlinePlay.DailyChallenge
},
new TruncatingSpriteText
{
Text = $"by {beatmap.Metadata.Author.Username}",
Text = BeatmappacksStrings.ShowCreatedBy(beatmap.Metadata.Author.Username),
Font = OsuFont.GetFont(size: 16, italics: true),
MaxWidth = horizontal_info_size,
Shear = -OsuGame.SHEAR,
@@ -12,6 +12,7 @@ using osu.Framework.Graphics.Containers;
using osu.Game.Beatmaps;
using osu.Game.Graphics.Containers;
using osu.Game.Graphics.UserInterface;
using osu.Game.Localisation;
using osu.Game.Online.API;
using osu.Game.Online.Rooms;
using osu.Game.Rulesets;
@@ -80,7 +81,7 @@ namespace osu.Game.Screens.OnlinePlay.DailyChallenge
],
Content = new[]
{
new Drawable[] { new SectionHeader("Leaderboard") },
new Drawable[] { new SectionHeader(OnlinePlayStrings.PlaylistLeaderboard) },
new Drawable[]
{
new Container
@@ -109,7 +110,7 @@ namespace osu.Game.Screens.OnlinePlay.DailyChallenge
}
}
},
new Drawable[] { userBestHeader = new SectionHeader("Personal best") { Alpha = 0, } },
new Drawable[] { userBestHeader = new SectionHeader(BeatmapLeaderboardWedgeStrings.PersonalBest) { Alpha = 0, } },
new Drawable[]
{
userBestContainer = new Container
@@ -14,6 +14,7 @@ using osu.Framework.Localisation;
using osu.Game.Graphics;
using osu.Game.Graphics.Sprites;
using osu.Game.Graphics.UserInterface;
using osu.Game.Localisation;
using osu.Game.Online.Metadata;
using osu.Game.Online.Rooms;
using osu.Game.Overlays;
@@ -36,7 +37,7 @@ namespace osu.Game.Screens.OnlinePlay.DailyChallenge
{
InternalChildren = new Drawable[]
{
new SectionHeader("Score breakdown"),
new SectionHeader(DailyChallengeStrings.SectionScoreBreakdown),
barsContainer = new FillFlowContainer<Bar>
{
Direction = FillDirection.Horizontal,
@@ -215,7 +216,7 @@ namespace osu.Game.Screens.OnlinePlay.DailyChallenge
Anchor = Anchor.BottomCentre,
Origin = Anchor.BottomCentre,
Colour = colours.Orange1,
Text = "You",
Text = DailyChallengeStrings.You,
Font = OsuFont.Default.With(weight: FontWeight.Bold),
Alpha = 0,
RelativePositionAxes = Axes.Y,
@@ -285,7 +286,7 @@ namespace osu.Game.Screens.OnlinePlay.DailyChallenge
flashLayer.FadeOutFromOne(600, Easing.OutQuint);
}
public LocalisableString TooltipText => LocalisableString.Format("{0:N0} passes in {1:N0} - {2:N0} range", count, BinStart, BinEnd);
public LocalisableString TooltipText => DailyChallengeStrings.ScoreBreakdownBarTooltip(count, BinStart, BinEnd);
}
}
}
@@ -11,6 +11,7 @@ using osu.Framework.Threading;
using osu.Game.Graphics;
using osu.Game.Graphics.Sprites;
using osu.Game.Graphics.UserInterface;
using osu.Game.Localisation;
using osu.Game.Online.Rooms;
using osu.Game.Overlays;
using osuTK;
@@ -40,7 +41,7 @@ namespace osu.Game.Screens.OnlinePlay.DailyChallenge
{
InternalChildren = new Drawable[]
{
new SectionHeader("Time remaining"),
new SectionHeader(DailyChallengeStrings.SectionTimeRemaining),
new DrawSizePreservingFillContainer
{
RelativeSizeAxes = Axes.Both,
@@ -10,6 +10,7 @@ using osu.Framework.Localisation;
using osu.Game.Graphics;
using osu.Game.Graphics.Sprites;
using osu.Game.Graphics.UserInterface;
using osu.Game.Localisation;
using osu.Game.Screens.OnlinePlay.DailyChallenge.Events;
using osuTK;
@@ -42,7 +43,7 @@ namespace osu.Game.Screens.OnlinePlay.DailyChallenge
{
new Drawable[]
{
new SectionHeader("Total pass count")
new SectionHeader(DailyChallengeStrings.SectionTotalPasses)
},
new Drawable[]
{
@@ -60,7 +61,7 @@ namespace osu.Game.Screens.OnlinePlay.DailyChallenge
},
new Drawable[]
{
new SectionHeader("Cumulative total score")
new SectionHeader(DailyChallengeStrings.SectionCumulativeScore)
},
new Drawable[]
{