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

Grouped localisation strings

This commit is contained in:
Daniel Källberg 2022-10-11 10:59:07 +02:00
parent 9c611019b3
commit 63e651130a
5 changed files with 22 additions and 50 deletions

View File

@ -1,24 +0,0 @@
// 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

@ -1,20 +0,0 @@
// 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

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

View File

@ -20,8 +20,8 @@ namespace osu.Game.Overlays.Toolbar
[BackgroundDependencyLoader]
private void load()
{
TooltipMain = HomeStrings.HeaderTitle;
TooltipSub = HomeStrings.HeaderDescription;
TooltipMain = ToolbarStrings.HomeHeaderTitle;
TooltipSub = ToolbarStrings.HomeHeaderDescription;
SetIcon("Icons/Hexacons/home");
}
}

View File

@ -3,14 +3,14 @@
#nullable disable
using osu.Framework.Graphics;
using osu.Framework.Graphics.Effects;
using osu.Framework.Graphics.UserInterface;
using osu.Game.Rulesets;
using osuTK.Graphics;
using osu.Framework.Graphics;
using osu.Framework.Input.Events;
using osu.Framework.Localisation;
using osu.Game.Localisation;
using osu.Game.Rulesets;
using osuTK.Graphics;
namespace osu.Game.Overlays.Toolbar
{
@ -31,7 +31,7 @@ namespace osu.Game.Overlays.Toolbar
var rInstance = value.CreateInstance();
ruleset.TooltipMain = rInstance.Description;
ruleset.TooltipSub = LocalisableString.Format("{0} {1}", RulesetStrings.HeaderDescription, ($"{rInstance.Description}"));
ruleset.TooltipSub = LocalisableString.Format("{0} {1}", ToolbarStrings.RulesetHeaderDescription, ($"{rInstance.Description}"));
ruleset.SetIcon(rInstance.CreateIcon());
}