1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-11 11:07:52 +08:00

Add localisation support

This commit is contained in:
Bartłomiej Dach 2024-03-15 10:58:00 +01:00
parent 4e2098adb8
commit 49a087f7fc
No known key found for this signature in database
2 changed files with 51 additions and 3 deletions

View File

@ -0,0 +1,48 @@
// 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 PlayerLoaderStrings
{
private const string prefix = @"osu.Game.Resources.Localisation.PlayerLoader";
/// <summary>
/// "This beatmap contains scenes with rapidly flashing colours"
/// </summary>
public static LocalisableString EpilepsyWarningTitle => new TranslatableString(getKey(@"epilepsy_warning_title"), @"This beatmap contains scenes with rapidly flashing colours");
/// <summary>
/// "Please take caution if you are affected by epilepsy."
/// </summary>
public static LocalisableString EpilepsyWarningContent => new TranslatableString(getKey(@"epilepsy_warning_content"), @"Please take caution if you are affected by epilepsy.");
/// <summary>
/// "This beatmap is loved"
/// </summary>
public static LocalisableString LovedBeatmapDisclaimerTitle => new TranslatableString(getKey(@"loved_beatmap_disclaimer_title"), @"This beatmap is loved");
/// <summary>
/// "No performance points will be awarded.
/// Leaderboards may be reset by the beatmap creator."
/// </summary>
public static LocalisableString LovedBeatmapDisclaimerContent => new TranslatableString(getKey(@"loved_beatmap_disclaimer_content"), @"No performance points will be awarded.
Leaderboards may be reset by the beatmap creator.");
/// <summary>
/// "This beatmap is qualified"
/// </summary>
public static LocalisableString QualifiedBeatmapDisclaimerTitle => new TranslatableString(getKey(@"qualified_beatmap_disclaimer_title"), @"This beatmap is qualified");
/// <summary>
/// "No performance points will be awarded.
/// Leaderboards will be reset when the beatmap is ranked."
/// </summary>
public static LocalisableString QualifiedBeatmapDisclaimerContent => new TranslatableString(getKey(@"qualified_beatmap_disclaimer_content"), @"No performance points will be awarded.
Leaderboards will be reset when the beatmap is ranked.");
private static string getKey(string key) => $@"{prefix}:{key}";
}
}

View File

@ -228,17 +228,17 @@ namespace osu.Game.Screens.Play
if (Beatmap.Value.BeatmapInfo.EpilepsyWarning) if (Beatmap.Value.BeatmapInfo.EpilepsyWarning)
{ {
disclaimers.Add(epilepsyWarning = new PlayerLoaderDisclaimer("This beatmap contains scenes with rapidly flashing colours", "Please take caution if you are affected by epilepsy.")); disclaimers.Add(epilepsyWarning = new PlayerLoaderDisclaimer(PlayerLoaderStrings.EpilepsyWarningTitle, PlayerLoaderStrings.EpilepsyWarningContent));
} }
switch (Beatmap.Value.BeatmapInfo.Status) switch (Beatmap.Value.BeatmapInfo.Status)
{ {
case BeatmapOnlineStatus.Loved: case BeatmapOnlineStatus.Loved:
disclaimers.Add(new PlayerLoaderDisclaimer("This beatmap is loved", "No performance points will be awarded.\nLeaderboards may be reset by the beatmap creator.")); disclaimers.Add(new PlayerLoaderDisclaimer(PlayerLoaderStrings.LovedBeatmapDisclaimerTitle, PlayerLoaderStrings.LovedBeatmapDisclaimerContent));
break; break;
case BeatmapOnlineStatus.Qualified: case BeatmapOnlineStatus.Qualified:
disclaimers.Add(new PlayerLoaderDisclaimer("This beatmap is qualified", "No performance points will be awarded.\nLeaderboards will be reset when the beatmap is ranked.")); disclaimers.Add(new PlayerLoaderDisclaimer(PlayerLoaderStrings.QualifiedBeatmapDisclaimerTitle, PlayerLoaderStrings.QualifiedBeatmapDisclaimerContent));
break; break;
} }
} }