mirror of
https://github.com/ppy/osu.git
synced 2025-02-21 23:59:16 +08:00
Add localisation support
This commit is contained in:
parent
e458f540ac
commit
2cab8f4e8a
@ -0,0 +1,49 @@
|
|||||||
|
// 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.SkinComponents
|
||||||
|
{
|
||||||
|
public static class SkinnableModDisplayStrings
|
||||||
|
{
|
||||||
|
private const string prefix = @"osu.Game.Resources.Localisation.SkinnableModDisplay";
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// "Show extended information"
|
||||||
|
/// </summary>
|
||||||
|
public static LocalisableString ShowExtendedInformation => new TranslatableString(getKey(@"show_extended_information"), @"Show extended information");
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// "Whether to show extended information for each mod."
|
||||||
|
/// </summary>
|
||||||
|
public static LocalisableString ShowExtendedInformationDescription => new TranslatableString(getKey(@"whether_to_show_extended_information"), @"Whether to show extended information for each mod.");
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// "Expansion mode"
|
||||||
|
/// </summary>
|
||||||
|
public static LocalisableString ExpansionMode => new TranslatableString(getKey(@"expansion_mode"), @"Expansion mode");
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// "How the mod display expands when interacted with."
|
||||||
|
/// </summary>
|
||||||
|
public static LocalisableString ExpansionModeDescription => new TranslatableString(getKey(@"how_the_mod_display_expands"), @"How the mod display expands when interacted with.");
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// "Expand on hover"
|
||||||
|
/// </summary>
|
||||||
|
public static LocalisableString ExpandOnHover => new TranslatableString(getKey(@"expand_on_hover"), @"Expand on hover");
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// "Always contracted"
|
||||||
|
/// </summary>
|
||||||
|
public static LocalisableString AlwaysContracted => new TranslatableString(getKey(@"always_contracted"), @"Always contracted");
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// "Always expanded"
|
||||||
|
/// </summary>
|
||||||
|
public static LocalisableString AlwaysExpanded => new TranslatableString(getKey(@"always_expanded"), @"Always expanded");
|
||||||
|
|
||||||
|
private static string getKey(string key) => $@"{prefix}:{key}";
|
||||||
|
}
|
||||||
|
}
|
@ -8,7 +8,10 @@ using osu.Framework.Graphics;
|
|||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.Graphics.UserInterface;
|
using osu.Framework.Graphics.UserInterface;
|
||||||
using osu.Framework.Input.Events;
|
using osu.Framework.Input.Events;
|
||||||
|
using osu.Framework.Localisation;
|
||||||
using osu.Game.Graphics.Containers;
|
using osu.Game.Graphics.Containers;
|
||||||
|
using osu.Game.Localisation;
|
||||||
|
using osu.Game.Localisation.SkinComponents;
|
||||||
using osu.Game.Rulesets.Mods;
|
using osu.Game.Rulesets.Mods;
|
||||||
using osu.Game.Rulesets.UI;
|
using osu.Game.Rulesets.UI;
|
||||||
using osuTK;
|
using osuTK;
|
||||||
@ -145,16 +148,19 @@ namespace osu.Game.Screens.Play.HUD
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// The <see cref="ModDisplay"/> will expand only when hovered.
|
/// The <see cref="ModDisplay"/> will expand only when hovered.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[LocalisableDescription(typeof(SkinnableModDisplayStrings), nameof(SkinnableModDisplayStrings.ExpandOnHover))]
|
||||||
ExpandOnHover,
|
ExpandOnHover,
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The <see cref="ModDisplay"/> will always be expanded.
|
/// The <see cref="ModDisplay"/> will always be expanded.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[LocalisableDescription(typeof(SkinnableModDisplayStrings), nameof(SkinnableModDisplayStrings.AlwaysExpanded))]
|
||||||
AlwaysExpanded,
|
AlwaysExpanded,
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The <see cref="ModDisplay"/> will always be contracted.
|
/// The <see cref="ModDisplay"/> will always be contracted.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[LocalisableDescription(typeof(SkinnableModDisplayStrings), nameof(SkinnableModDisplayStrings.AlwaysContracted))]
|
||||||
AlwaysContracted,
|
AlwaysContracted,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -9,6 +9,8 @@ using osu.Framework.Graphics.Containers;
|
|||||||
using osu.Game.Configuration;
|
using osu.Game.Configuration;
|
||||||
using osu.Game.Rulesets.Mods;
|
using osu.Game.Rulesets.Mods;
|
||||||
using osu.Game.Skinning;
|
using osu.Game.Skinning;
|
||||||
|
using osu.Game.Localisation;
|
||||||
|
using osu.Game.Localisation.SkinComponents;
|
||||||
|
|
||||||
namespace osu.Game.Screens.Play.HUD
|
namespace osu.Game.Screens.Play.HUD
|
||||||
{
|
{
|
||||||
@ -22,11 +24,11 @@ namespace osu.Game.Screens.Play.HUD
|
|||||||
[Resolved]
|
[Resolved]
|
||||||
private Bindable<IReadOnlyList<Mod>> mods { get; set; } = null!;
|
private Bindable<IReadOnlyList<Mod>> mods { get; set; } = null!;
|
||||||
|
|
||||||
[SettingSource("Show extended info", "Whether to show extended information for each mod.")]
|
[SettingSource(typeof(SkinnableModDisplayStrings), nameof(SkinnableModDisplayStrings.ShowExtendedInformation), nameof(SkinnableModDisplayStrings.ShowExtendedInformationDescription))]
|
||||||
public Bindable<bool> ShowExtendedInformation { get; } = new Bindable<bool>(true);
|
public Bindable<bool> ShowExtendedInformation { get; } = new Bindable<bool>(true);
|
||||||
|
|
||||||
[SettingSource("Expansion mode", "How the mod display expands when interacted with.")]
|
[SettingSource(typeof(SkinnableModDisplayStrings), nameof(SkinnableModDisplayStrings.ExpansionMode), nameof(SkinnableModDisplayStrings.ExpansionModeDescription))]
|
||||||
public Bindable<ExpansionMode> ExpansionModeSetting { get; } = new Bindable<ExpansionMode>(ExpansionMode.ExpandOnHover);
|
public Bindable<ExpansionMode> ExpansionModeSetting { get; } = new Bindable<ExpansionMode>();
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load()
|
private void load()
|
||||||
|
Loading…
Reference in New Issue
Block a user