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

Merge pull request #20709 from Domilz/toolbar-localisation

Localise toolbar home button and ruleset description tooltips
This commit is contained in:
Dean Herbert 2023-01-17 17:28:34 +09:00 committed by GitHub
commit c799375ae0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 22 additions and 5 deletions

View File

@ -19,6 +19,21 @@ namespace osu.Game.Localisation
/// </summary>
public static LocalisableString Connecting => new TranslatableString(getKey(@"connecting"), @"Connecting...");
/// <summary>
/// "home"
/// </summary>
public static LocalisableString HomeHeaderTitle => new TranslatableString(getKey(@"home_header_title"), @"home");
/// <summary>
/// "return to the main menu"
/// </summary>
public static LocalisableString HomeHeaderDescription => new TranslatableString(getKey(@"home_header_description"), @"return to the main menu");
/// <summary>
/// "play some {0}"
/// </summary>
public static LocalisableString PlaySomeRuleset(string arg0) => new TranslatableString(getKey(@"play_some_ruleset"), @"play some {0}", arg0);
private static string getKey(string key) => $@"{prefix}:{key}";
}
}

View File

@ -5,6 +5,7 @@
using osu.Framework.Allocation;
using osu.Game.Input.Bindings;
using osu.Game.Localisation;
namespace osu.Game.Overlays.Toolbar
{
@ -19,8 +20,8 @@ namespace osu.Game.Overlays.Toolbar
[BackgroundDependencyLoader]
private void load()
{
TooltipMain = "home";
TooltipSub = "return to the main menu";
TooltipMain = ToolbarStrings.HomeHeaderTitle;
TooltipSub = ToolbarStrings.HomeHeaderDescription;
SetIcon("Icons/Hexacons/home");
}
}

View File

@ -3,12 +3,13 @@
#nullable disable
using osu.Framework.Graphics;
using osu.Framework.Graphics.Effects;
using osu.Framework.Graphics.UserInterface;
using osu.Framework.Input.Events;
using osu.Game.Localisation;
using osu.Game.Rulesets;
using osuTK.Graphics;
using osu.Framework.Graphics;
using osu.Framework.Input.Events;
namespace osu.Game.Overlays.Toolbar
{
@ -29,7 +30,7 @@ namespace osu.Game.Overlays.Toolbar
var rInstance = value.CreateInstance();
ruleset.TooltipMain = rInstance.Description;
ruleset.TooltipSub = $"play some {rInstance.Description}";
ruleset.TooltipSub = ToolbarStrings.PlaySomeRuleset(rInstance.Description);
ruleset.SetIcon(rInstance.CreateIcon());
}