mirror of
https://github.com/ppy/osu.git
synced 2025-01-26 12:45:09 +08:00
Toolbar localisation
This commit is contained in:
parent
7342fb7f51
commit
9c611019b3
24
osu.Game/Localisation/HomeStrings.cs
Normal file
24
osu.Game/Localisation/HomeStrings.cs
Normal 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}";
|
||||||
|
}
|
||||||
|
}
|
20
osu.Game/Localisation/RulesetStrings.cs
Normal file
20
osu.Game/Localisation/RulesetStrings.cs
Normal 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}";
|
||||||
|
}
|
||||||
|
}
|
@ -5,6 +5,7 @@
|
|||||||
|
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Game.Input.Bindings;
|
using osu.Game.Input.Bindings;
|
||||||
|
using osu.Game.Localisation;
|
||||||
|
|
||||||
namespace osu.Game.Overlays.Toolbar
|
namespace osu.Game.Overlays.Toolbar
|
||||||
{
|
{
|
||||||
@ -19,8 +20,8 @@ namespace osu.Game.Overlays.Toolbar
|
|||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load()
|
private void load()
|
||||||
{
|
{
|
||||||
TooltipMain = "home";
|
TooltipMain = HomeStrings.HeaderTitle;
|
||||||
TooltipSub = "return to the main menu";
|
TooltipSub = HomeStrings.HeaderDescription;
|
||||||
SetIcon("Icons/Hexacons/home");
|
SetIcon("Icons/Hexacons/home");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -9,6 +9,8 @@ using osu.Game.Rulesets;
|
|||||||
using osuTK.Graphics;
|
using osuTK.Graphics;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Input.Events;
|
using osu.Framework.Input.Events;
|
||||||
|
using osu.Framework.Localisation;
|
||||||
|
using osu.Game.Localisation;
|
||||||
|
|
||||||
namespace osu.Game.Overlays.Toolbar
|
namespace osu.Game.Overlays.Toolbar
|
||||||
{
|
{
|
||||||
@ -29,7 +31,7 @@ namespace osu.Game.Overlays.Toolbar
|
|||||||
var rInstance = value.CreateInstance();
|
var rInstance = value.CreateInstance();
|
||||||
|
|
||||||
ruleset.TooltipMain = rInstance.Description;
|
ruleset.TooltipMain = rInstance.Description;
|
||||||
ruleset.TooltipSub = $"play some {rInstance.Description}";
|
ruleset.TooltipSub = LocalisableString.Format("{0} {1}", RulesetStrings.HeaderDescription, ($"{rInstance.Description}"));
|
||||||
ruleset.SetIcon(rInstance.CreateIcon());
|
ruleset.SetIcon(rInstance.CreateIcon());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user