mirror of
https://github.com/ppy/osu
synced 2024-12-23 15:22:37 +00:00
Localise more toast related strings
This commit is contained in:
parent
bae404f742
commit
4fc84e71cd
@ -7,6 +7,7 @@ using osu.Framework.Configuration;
|
||||
using osu.Framework.Configuration.Tracking;
|
||||
using osu.Framework.Extensions;
|
||||
using osu.Framework.Extensions.LocalisationExtensions;
|
||||
using osu.Framework.Localisation;
|
||||
using osu.Framework.Platform;
|
||||
using osu.Framework.Testing;
|
||||
using osu.Game.Input;
|
||||
@ -201,7 +202,7 @@ namespace osu.Game.Configuration
|
||||
|
||||
public Func<int, string> LookupSkinName { private get; set; }
|
||||
|
||||
public Func<GlobalAction, string> LookupKeyBindings { get; set; }
|
||||
public Func<GlobalAction, LocalisableString> LookupKeyBindings { get; set; }
|
||||
}
|
||||
|
||||
// IMPORTANT: These are used in user configuration files.
|
||||
|
39
osu.Game/Localisation/ToastStrings.cs
Normal file
39
osu.Game/Localisation/ToastStrings.cs
Normal file
@ -0,0 +1,39 @@
|
||||
// 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 ToastStrings
|
||||
{
|
||||
private const string prefix = @"osu.Game.Resources.Localisation.Toast";
|
||||
|
||||
/// <summary>
|
||||
/// "no key bound"
|
||||
/// </summary>
|
||||
public static LocalisableString NoKeyBound => new TranslatableString(getKey(@"no_key_bound"), @"no key bound");
|
||||
|
||||
/// <summary>
|
||||
/// "Music Playback"
|
||||
/// </summary>
|
||||
public static LocalisableString MusicPlayback => new TranslatableString(getKey(@"music_playback"), @"Music Playback");
|
||||
|
||||
/// <summary>
|
||||
/// "Pause track"
|
||||
/// </summary>
|
||||
public static LocalisableString PauseTrack => new TranslatableString(getKey(@"pause_track"), @"Pause track");
|
||||
|
||||
/// <summary>
|
||||
/// "Play track"
|
||||
/// </summary>
|
||||
public static LocalisableString PlayTrack => new TranslatableString(getKey(@"play_track"), @"Play track");
|
||||
|
||||
/// <summary>
|
||||
/// "Restart track"
|
||||
/// </summary>
|
||||
public static LocalisableString RestartTrack => new TranslatableString(getKey(@"restart_track"), @"Restart track");
|
||||
|
||||
private static string getKey(string key) => $@"{prefix}:{key}";
|
||||
}
|
||||
}
|
@ -638,7 +638,7 @@ namespace osu.Game
|
||||
var combinations = KeyBindingStore.GetReadableKeyCombinationsFor(l);
|
||||
|
||||
if (combinations.Count == 0)
|
||||
return "none";
|
||||
return ToastStrings.NoKeyBound;
|
||||
|
||||
return string.Join(" or ", combinations);
|
||||
};
|
||||
|
@ -3,6 +3,7 @@
|
||||
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Extensions.LocalisationExtensions;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Input.Bindings;
|
||||
using osu.Framework.Input.Events;
|
||||
@ -41,7 +42,7 @@ namespace osu.Game.Overlays.Music
|
||||
bool wasPlaying = musicController.IsPlaying;
|
||||
|
||||
if (musicController.TogglePause())
|
||||
onScreenDisplay?.Display(new MusicActionToast(wasPlaying ? "Pause track" : "Play track", e.Action));
|
||||
onScreenDisplay?.Display(new MusicActionToast(wasPlaying ? ToastStrings.PauseTrack : ToastStrings.PlayTrack, e.Action));
|
||||
return true;
|
||||
|
||||
case GlobalAction.MusicNext:
|
||||
@ -55,7 +56,7 @@ namespace osu.Game.Overlays.Music
|
||||
switch (res)
|
||||
{
|
||||
case PreviousTrackResult.Restart:
|
||||
onScreenDisplay?.Display(new MusicActionToast("Restart track", e.Action));
|
||||
onScreenDisplay?.Display(new MusicActionToast(ToastStrings.RestartTrack, e.Action));
|
||||
break;
|
||||
|
||||
case PreviousTrackResult.Previous:
|
||||
@ -79,7 +80,7 @@ namespace osu.Game.Overlays.Music
|
||||
private readonly GlobalAction action;
|
||||
|
||||
public MusicActionToast(LocalisableString value, GlobalAction action)
|
||||
: base("Music Playback", value, string.Empty)
|
||||
: base(ToastStrings.MusicPlayback, value, string.Empty)
|
||||
{
|
||||
this.action = action;
|
||||
}
|
||||
@ -87,7 +88,7 @@ namespace osu.Game.Overlays.Music
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuConfigManager config)
|
||||
{
|
||||
ShortcutText.Text = config.LookupKeyBindings(action).ToUpperInvariant();
|
||||
ShortcutText.Text = config.LookupKeyBindings(action).ToUpper();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -10,6 +10,7 @@ using osu.Game.Graphics;
|
||||
using osu.Game.Graphics.Sprites;
|
||||
using osuTK;
|
||||
using osuTK.Graphics;
|
||||
using osu.Game.Localisation;
|
||||
|
||||
namespace osu.Game.Overlays.OSD
|
||||
{
|
||||
@ -81,7 +82,7 @@ namespace osu.Game.Overlays.OSD
|
||||
Alpha = 0.3f,
|
||||
Margin = new MarginPadding { Bottom = 15, Horizontal = 10 },
|
||||
Font = OsuFont.GetFont(size: 12, weight: FontWeight.Bold),
|
||||
Text = string.IsNullOrEmpty(shortcut.ToString()) ? (LocalisableString)"NO KEY BOUND" : shortcut.ToUpper()
|
||||
Text = string.IsNullOrEmpty(shortcut.ToString()) ? ToastStrings.NoKeyBound.ToUpper() : shortcut.ToUpper()
|
||||
},
|
||||
};
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user