mirror of
https://github.com/ppy/osu.git
synced 2025-01-12 17:43:05 +08:00
Add localisation support for leaderboard error text
This commit is contained in:
parent
c342030b2c
commit
d4a2645510
49
osu.Game/Localisation/LeaderboardStrings.cs
Normal file
49
osu.Game/Localisation/LeaderboardStrings.cs
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||||
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
|
using osu.Framework.Localisation;
|
||||||
|
|
||||||
|
namespace osu.Game.Localisation
|
||||||
|
{
|
||||||
|
public static class LeaderboardStrings
|
||||||
|
{
|
||||||
|
private const string prefix = @"osu.Game.Resources.Localisation.Leaderboard";
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// "Couldn't fetch scores!"
|
||||||
|
/// </summary>
|
||||||
|
public static LocalisableString CouldntFetchScores => new TranslatableString(getKey(@"couldnt_fetch_scores"), @"Couldn't fetch scores!");
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// "Please select a beatmap!"
|
||||||
|
/// </summary>
|
||||||
|
public static LocalisableString PleaseSelectABeatmap => new TranslatableString(getKey(@"please_select_a_beatmap"), @"Please select a beatmap!");
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// "Leaderboards are not available for this ruleset!"
|
||||||
|
/// </summary>
|
||||||
|
public static LocalisableString LeaderboardsAreNotAvailableForThisRuleset => new TranslatableString(getKey(@"leaderboards_are_not_available_for_this_ruleset"), @"Leaderboards are not available for this ruleset!");
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// "Leaderboards are not available for this beatmap!"
|
||||||
|
/// </summary>
|
||||||
|
public static LocalisableString LeaderboardsAreNotAvailableForThisBeatmap => new TranslatableString(getKey(@"leaderboards_are_not_available_for_this_beatmap"), @"Leaderboards are not available for this beatmap!");
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// "No records yet!"
|
||||||
|
/// </summary>
|
||||||
|
public static LocalisableString NoRecordsYet => new TranslatableString(getKey(@"no_records_yet"), @"No records yet!");
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// "Please sign in to view online leaderboards!"
|
||||||
|
/// </summary>
|
||||||
|
public static LocalisableString PleaseSignInToViewOnlineLeaderboards => new TranslatableString(getKey(@"please_sign_in_to_view_online_leaderboards"), @"Please sign in to view online leaderboards!");
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// "Please invest in an osu!supporter tag to view this leaderboard!"
|
||||||
|
/// </summary>
|
||||||
|
public static LocalisableString PleaseInvestInAnOsuSupporterTagToViewThisLeaderboard => new TranslatableString(getKey(@"please_invest_in_an_osu_supporter_tag_to_view_this_leaderboard"), @"Please invest in an osu!supporter tag to view this leaderboard!");
|
||||||
|
|
||||||
|
private static string getKey(string key) => $@"{prefix}:{key}";
|
||||||
|
}
|
||||||
|
}
|
@ -22,6 +22,7 @@ using osu.Game.Online.API;
|
|||||||
using osu.Game.Online.Placeholders;
|
using osu.Game.Online.Placeholders;
|
||||||
using osuTK;
|
using osuTK;
|
||||||
using osuTK.Graphics;
|
using osuTK.Graphics;
|
||||||
|
using osu.Game.Localisation;
|
||||||
|
|
||||||
namespace osu.Game.Online.Leaderboards
|
namespace osu.Game.Online.Leaderboards
|
||||||
{
|
{
|
||||||
@ -311,28 +312,28 @@ namespace osu.Game.Online.Leaderboards
|
|||||||
switch (state)
|
switch (state)
|
||||||
{
|
{
|
||||||
case LeaderboardState.NetworkFailure:
|
case LeaderboardState.NetworkFailure:
|
||||||
return new ClickablePlaceholder(@"Couldn't fetch scores!", FontAwesome.Solid.Sync)
|
return new ClickablePlaceholder(LeaderboardStrings.CouldntFetchScores, FontAwesome.Solid.Sync)
|
||||||
{
|
{
|
||||||
Action = RefetchScores
|
Action = RefetchScores
|
||||||
};
|
};
|
||||||
|
|
||||||
case LeaderboardState.NoneSelected:
|
case LeaderboardState.NoneSelected:
|
||||||
return new MessagePlaceholder(@"Please select a beatmap!");
|
return new MessagePlaceholder(LeaderboardStrings.PleaseSelectABeatmap);
|
||||||
|
|
||||||
case LeaderboardState.RulesetUnavailable:
|
case LeaderboardState.RulesetUnavailable:
|
||||||
return new MessagePlaceholder(@"Leaderboards are not available for this ruleset!");
|
return new MessagePlaceholder(LeaderboardStrings.LeaderboardsAreNotAvailableForThisRuleset);
|
||||||
|
|
||||||
case LeaderboardState.BeatmapUnavailable:
|
case LeaderboardState.BeatmapUnavailable:
|
||||||
return new MessagePlaceholder(@"Leaderboards are not available for this beatmap!");
|
return new MessagePlaceholder(LeaderboardStrings.LeaderboardsAreNotAvailableForThisBeatmap);
|
||||||
|
|
||||||
case LeaderboardState.NoScores:
|
case LeaderboardState.NoScores:
|
||||||
return new MessagePlaceholder(@"No records yet!");
|
return new MessagePlaceholder(LeaderboardStrings.NoRecordsYet);
|
||||||
|
|
||||||
case LeaderboardState.NotLoggedIn:
|
case LeaderboardState.NotLoggedIn:
|
||||||
return new LoginPlaceholder(@"Please sign in to view online leaderboards!");
|
return new LoginPlaceholder(LeaderboardStrings.PleaseSignInToViewOnlineLeaderboards);
|
||||||
|
|
||||||
case LeaderboardState.NotSupporter:
|
case LeaderboardState.NotSupporter:
|
||||||
return new MessagePlaceholder(@"Please invest in an osu!supporter tag to view this leaderboard!");
|
return new MessagePlaceholder(LeaderboardStrings.PleaseInvestInAnOsuSupporterTagToViewThisLeaderboard);
|
||||||
|
|
||||||
case LeaderboardState.Retrieving:
|
case LeaderboardState.Retrieving:
|
||||||
return null;
|
return null;
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Graphics.Sprites;
|
using osu.Framework.Graphics.Sprites;
|
||||||
|
using osu.Framework.Localisation;
|
||||||
using osu.Game.Overlays;
|
using osu.Game.Overlays;
|
||||||
|
|
||||||
namespace osu.Game.Online.Placeholders
|
namespace osu.Game.Online.Placeholders
|
||||||
@ -12,7 +13,7 @@ namespace osu.Game.Online.Placeholders
|
|||||||
[Resolved(CanBeNull = true)]
|
[Resolved(CanBeNull = true)]
|
||||||
private LoginOverlay login { get; set; }
|
private LoginOverlay login { get; set; }
|
||||||
|
|
||||||
public LoginPlaceholder(string actionMessage)
|
public LoginPlaceholder(LocalisableString actionMessage)
|
||||||
: base(actionMessage, FontAwesome.Solid.UserLock)
|
: base(actionMessage, FontAwesome.Solid.UserLock)
|
||||||
{
|
{
|
||||||
Action = () => login?.Show();
|
Action = () => login?.Show();
|
||||||
|
Loading…
Reference in New Issue
Block a user