1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-12 15:22:55 +08:00

Localise detail buttons.

This commit is contained in:
Lucas A 2021-08-07 18:27:55 +02:00
parent 7bbc917f75
commit fc48696718
3 changed files with 34 additions and 7 deletions

View File

@ -0,0 +1,24 @@
// 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 DownloadButtonStrings
{
private const string prefix = @"osu.Game.Resources.Localisation.DownloadButton";
/// <summary>
/// "Downloading..."
/// </summary>
public static LocalisableString Downloading => new TranslatableString(getKey(@"downloading"), @"Downloading...");
/// <summary>
/// "Importing..."
/// </summary>
public static LocalisableString Importing => new TranslatableString(getKey(@"importing"), @"Importing...");
private static string getKey(string key) => $@"{prefix}:{key}";
}
}

View File

@ -13,6 +13,7 @@ using osu.Game.Graphics.UserInterface;
using osu.Game.Online.API; using osu.Game.Online.API;
using osu.Game.Online.API.Requests; using osu.Game.Online.API.Requests;
using osu.Game.Overlays.Notifications; using osu.Game.Overlays.Notifications;
using osu.Game.Resources.Localisation.Web;
using osu.Game.Users; using osu.Game.Users;
using osuTK; using osuTK;
@ -35,7 +36,7 @@ namespace osu.Game.Overlays.BeatmapSet.Buttons
{ {
if (!Enabled.Value) return string.Empty; if (!Enabled.Value) return string.Empty;
return (favourited.Value ? "Unfavourite" : "Favourite") + " this beatmapset"; return favourited.Value ? BeatmapsetsStrings.ShowDetailsUnfavourite : BeatmapsetsStrings.ShowDetailsFavourite;
} }
} }

View File

@ -15,9 +15,11 @@ using osu.Game.Graphics.Sprites;
using osu.Game.Online; using osu.Game.Online;
using osu.Game.Online.API; using osu.Game.Online.API;
using osu.Game.Overlays.BeatmapListing.Panels; using osu.Game.Overlays.BeatmapListing.Panels;
using osu.Game.Resources.Localisation.Web;
using osu.Game.Users; using osu.Game.Users;
using osuTK; using osuTK;
using osuTK.Graphics; using osuTK.Graphics;
using osu.Game.Localisation;
namespace osu.Game.Overlays.BeatmapSet.Buttons namespace osu.Game.Overlays.BeatmapSet.Buttons
{ {
@ -27,7 +29,7 @@ namespace osu.Game.Overlays.BeatmapSet.Buttons
private readonly bool noVideo; private readonly bool noVideo;
public LocalisableString TooltipText => button.Enabled.Value ? "download this beatmap" : "login to download"; public LocalisableString TooltipText => button.Enabled.Value ? BeatmapsetsStrings.ShowDetailsDownloadDefault : BeatmapsetsStrings.ShowDetailsLoggedOut;
private readonly IBindable<User> localUser = new Bindable<User>(); private readonly IBindable<User> localUser = new Bindable<User>();
@ -113,7 +115,7 @@ namespace osu.Game.Overlays.BeatmapSet.Buttons
{ {
new OsuSpriteText new OsuSpriteText
{ {
Text = "Downloading...", Text = DownloadButtonStrings.Downloading,
Font = OsuFont.GetFont(size: text_size, weight: FontWeight.Bold) Font = OsuFont.GetFont(size: text_size, weight: FontWeight.Bold)
}, },
}; };
@ -124,7 +126,7 @@ namespace osu.Game.Overlays.BeatmapSet.Buttons
{ {
new OsuSpriteText new OsuSpriteText
{ {
Text = "Importing...", Text = DownloadButtonStrings.Importing,
Font = OsuFont.GetFont(size: text_size, weight: FontWeight.Bold) Font = OsuFont.GetFont(size: text_size, weight: FontWeight.Bold)
}, },
}; };
@ -139,7 +141,7 @@ namespace osu.Game.Overlays.BeatmapSet.Buttons
{ {
new OsuSpriteText new OsuSpriteText
{ {
Text = "Download", Text = BeatmapsetsStrings.ShowDetailsDownloadDefault,
Font = OsuFont.GetFont(size: text_size, weight: FontWeight.Bold) Font = OsuFont.GetFont(size: text_size, weight: FontWeight.Bold)
}, },
new OsuSpriteText new OsuSpriteText
@ -158,12 +160,12 @@ namespace osu.Game.Overlays.BeatmapSet.Buttons
private void enabledChanged(ValueChangedEvent<bool> e) => this.FadeColour(e.NewValue ? Color4.White : Color4.Gray, 200, Easing.OutQuint); private void enabledChanged(ValueChangedEvent<bool> e) => this.FadeColour(e.NewValue ? Color4.White : Color4.Gray, 200, Easing.OutQuint);
private string getVideoSuffixText() private LocalisableString getVideoSuffixText()
{ {
if (!BeatmapSet.Value.OnlineInfo.HasVideo) if (!BeatmapSet.Value.OnlineInfo.HasVideo)
return string.Empty; return string.Empty;
return noVideo ? "without Video" : "with Video"; return noVideo ? BeatmapsetsStrings.ShowDetailsDownloadNoVideo : BeatmapsetsStrings.ShowDetailsDownloadVideo;
} }
} }
} }