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

Toolbar localisation

This commit is contained in:
Daniel Källberg 2022-10-11 09:30:32 +02:00
parent 7342fb7f51
commit 9c611019b3
4 changed files with 50 additions and 3 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 HomeStrings
{
private const string prefix = @"osu.Game.Resources.Localisation.Home";
/// <summary>
/// "home"
/// </summary>
public static LocalisableString HeaderTitle => new TranslatableString(getKey(@"header_title"), @"home");
/// <summary>
/// "return to the main menu"
/// </summary>
public static LocalisableString HeaderDescription => new TranslatableString(getKey(@"header_description"), @"return to the main menu");
private static string getKey(string key) => $"{prefix}:{key}";
}
}

View File

@ -0,0 +1,20 @@
// 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 RulesetStrings
{
private const string prefix = @"osu.Game.Resources.Localisation.Ruleset";
/// <summary>
/// "play some"
/// </summary>
public static LocalisableString HeaderDescription => new TranslatableString(getKey(@"header_description"), @"play some");
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 = HomeStrings.HeaderTitle;
TooltipSub = HomeStrings.HeaderDescription;
SetIcon("Icons/Hexacons/home");
}
}

View File

@ -9,6 +9,8 @@ using osu.Game.Rulesets;
using osuTK.Graphics;
using osu.Framework.Graphics;
using osu.Framework.Input.Events;
using osu.Framework.Localisation;
using osu.Game.Localisation;
namespace osu.Game.Overlays.Toolbar
{
@ -29,7 +31,7 @@ namespace osu.Game.Overlays.Toolbar
var rInstance = value.CreateInstance();
ruleset.TooltipMain = rInstance.Description;
ruleset.TooltipSub = $"play some {rInstance.Description}";
ruleset.TooltipSub = LocalisableString.Format("{0} {1}", RulesetStrings.HeaderDescription, ($"{rInstance.Description}"));
ruleset.SetIcon(rInstance.CreateIcon());
}