Update usages of IHasTooltip in line with framework localisation changes

This commit is contained in:
Bartłomiej Dach 2021-06-25 19:10:04 +02:00
parent ee6cf4396a
commit 50c27d2635
42 changed files with 87 additions and 50 deletions

View File

@ -3,6 +3,7 @@
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Localisation;
using osu.Game.Graphics.UserInterface; using osu.Game.Graphics.UserInterface;
using osu.Game.Overlays.Settings; using osu.Game.Overlays.Settings;
using osu.Game.Rulesets.Mania.Configuration; using osu.Game.Rulesets.Mania.Configuration;
@ -47,7 +48,7 @@ namespace osu.Game.Rulesets.Mania
private class TimeSlider : OsuSliderBar<double> private class TimeSlider : OsuSliderBar<double>
{ {
public override string TooltipText => Current.Value.ToString("N0") + "ms"; public override LocalisableString TooltipText => Current.Value.ToString(@"N0") + "ms";
} }
} }
} }

View File

@ -13,6 +13,7 @@ using osu.Framework.Graphics.Cursor;
using osu.Framework.Graphics.Primitives; using osu.Framework.Graphics.Primitives;
using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Shapes;
using osu.Framework.Input.Events; using osu.Framework.Input.Events;
using osu.Framework.Localisation;
using osu.Framework.Utils; using osu.Framework.Utils;
using osu.Game.Graphics; using osu.Game.Graphics;
using osu.Game.Rulesets.Edit; using osu.Game.Rulesets.Edit;
@ -283,6 +284,6 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders.Components
} }
} }
public string TooltipText => ControlPoint.Type.Value.ToString() ?? string.Empty; public LocalisableString TooltipText => ControlPoint.Type.Value.ToString() ?? string.Empty;
} }
} }

View File

@ -10,6 +10,7 @@ using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Cursor; using osu.Framework.Graphics.Cursor;
using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Shapes;
using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Sprites;
using osu.Framework.Localisation;
using osu.Game.Graphics; using osu.Game.Graphics;
using osu.Game.Graphics.Containers; using osu.Game.Graphics.Containers;
using osuTK; using osuTK;
@ -59,7 +60,7 @@ namespace osu.Game.Tests.Visual.UserInterface
private class Icon : Container, IHasTooltip private class Icon : Container, IHasTooltip
{ {
public string TooltipText { get; } public LocalisableString TooltipText { get; }
public SpriteIcon SpriteIcon { get; } public SpriteIcon SpriteIcon { get; }

View File

@ -31,7 +31,7 @@ namespace osu.Game.Configuration
{ {
public LocalisableString Label { get; } public LocalisableString Label { get; }
public string Description { get; } public LocalisableString Description { get; }
public int? OrderPosition { get; } public int? OrderPosition { get; }

View File

@ -4,12 +4,13 @@
using Markdig.Syntax.Inlines; using Markdig.Syntax.Inlines;
using osu.Framework.Graphics.Containers.Markdown; using osu.Framework.Graphics.Containers.Markdown;
using osu.Framework.Graphics.Cursor; using osu.Framework.Graphics.Cursor;
using osu.Framework.Localisation;
namespace osu.Game.Graphics.Containers.Markdown namespace osu.Game.Graphics.Containers.Markdown
{ {
public class OsuMarkdownImage : MarkdownImage, IHasTooltip public class OsuMarkdownImage : MarkdownImage, IHasTooltip
{ {
public string TooltipText { get; } public LocalisableString TooltipText { get; }
public OsuMarkdownImage(LinkInline linkInline) public OsuMarkdownImage(LinkInline linkInline)
: base(linkInline.Url) : base(linkInline.Url)

View File

@ -5,6 +5,7 @@ using osu.Framework.Allocation;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Cursor; using osu.Framework.Graphics.Cursor;
using osu.Framework.Localisation;
using osu.Game.Graphics.UserInterface; using osu.Game.Graphics.UserInterface;
namespace osu.Game.Graphics.Containers namespace osu.Game.Graphics.Containers
@ -24,7 +25,7 @@ namespace osu.Game.Graphics.Containers
this.sampleSet = sampleSet; this.sampleSet = sampleSet;
} }
public virtual string TooltipText { get; set; } public virtual LocalisableString TooltipText { get; set; }
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load() private void load()

View File

@ -9,6 +9,7 @@ using osu.Framework.Graphics;
using osu.Framework.Graphics.Cursor; using osu.Framework.Graphics.Cursor;
using osu.Framework.Graphics.Effects; using osu.Framework.Graphics.Effects;
using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Shapes;
using osu.Framework.Localisation;
using osu.Game.Graphics.Sprites; using osu.Game.Graphics.Sprites;
namespace osu.Game.Graphics.Cursor namespace osu.Game.Graphics.Cursor
@ -32,7 +33,7 @@ namespace osu.Game.Graphics.Cursor
public override bool SetContent(object content) public override bool SetContent(object content)
{ {
if (!(content is string contentString)) if (!(content is LocalisableString contentString))
return false; return false;
if (contentString == text.Text) return true; if (contentString == text.Text) return true;

View File

@ -7,6 +7,7 @@ using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Cursor; using osu.Framework.Graphics.Cursor;
using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Sprites;
using osu.Framework.Input.Events; using osu.Framework.Input.Events;
using osu.Framework.Localisation;
using osu.Framework.Platform; using osu.Framework.Platform;
using osuTK; using osuTK;
using osuTK.Graphics; using osuTK.Graphics;
@ -58,6 +59,6 @@ namespace osu.Game.Graphics.UserInterface
return true; return true;
} }
public string TooltipText => "view in browser"; public LocalisableString TooltipText => "view in browser";
} }
} }

View File

@ -12,6 +12,7 @@ using osu.Framework.Graphics.Shapes;
using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Sprites;
using osu.Framework.Input; using osu.Framework.Input;
using osu.Framework.Input.Events; using osu.Framework.Input.Events;
using osu.Framework.Localisation;
using osu.Framework.Platform; using osu.Framework.Platform;
namespace osu.Game.Graphics.UserInterface namespace osu.Game.Graphics.UserInterface
@ -105,7 +106,7 @@ namespace osu.Game.Graphics.UserInterface
private class CapsWarning : SpriteIcon, IHasTooltip private class CapsWarning : SpriteIcon, IHasTooltip
{ {
public string TooltipText => @"caps lock is active"; public LocalisableString TooltipText => "caps lock is active";
public CapsWarning() public CapsWarning()
{ {

View File

@ -14,6 +14,7 @@ using osu.Framework.Graphics.UserInterface;
using osu.Framework.Graphics.Cursor; using osu.Framework.Graphics.Cursor;
using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Shapes;
using osu.Framework.Input.Events; using osu.Framework.Input.Events;
using osu.Framework.Localisation;
namespace osu.Game.Graphics.UserInterface namespace osu.Game.Graphics.UserInterface
{ {
@ -34,7 +35,7 @@ namespace osu.Game.Graphics.UserInterface
private readonly Box rightBox; private readonly Box rightBox;
private readonly Container nubContainer; private readonly Container nubContainer;
public virtual string TooltipText { get; private set; } public virtual LocalisableString TooltipText { get; private set; }
/// <summary> /// <summary>
/// Whether to format the tooltip as a percentage or the actual value. /// Whether to format the tooltip as a percentage or the actual value.

View File

@ -13,6 +13,7 @@ using osu.Framework.Graphics.Shapes;
using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Sprites;
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; using osu.Game.Graphics;
using osu.Game.Graphics.Containers; using osu.Game.Graphics.Containers;
using osu.Game.Graphics.Sprites; using osu.Game.Graphics.Sprites;
@ -295,7 +296,7 @@ namespace osu.Game.Online.Leaderboards
public override bool Contains(Vector2 screenSpacePos) => content.Contains(screenSpacePos); public override bool Contains(Vector2 screenSpacePos) => content.Contains(screenSpacePos);
public string TooltipText { get; } public LocalisableString TooltipText { get; }
public ScoreComponentLabel(LeaderboardScoreStatistic statistic) public ScoreComponentLabel(LeaderboardScoreStatistic statistic)
{ {
@ -365,7 +366,7 @@ namespace osu.Game.Online.Leaderboards
}; };
} }
public string TooltipText { get; } public LocalisableString TooltipText { get; }
} }
public class LeaderboardScoreStatistic public class LeaderboardScoreStatistic

View File

@ -95,7 +95,7 @@ namespace osu.Game.Overlays.BeatmapSet
{ {
private readonly OsuSpriteText value; private readonly OsuSpriteText value;
public string TooltipText { get; } public LocalisableString TooltipText { get; }
public LocalisableString Value public LocalisableString Value
{ {

View File

@ -7,6 +7,7 @@ using osu.Framework.Bindables;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Cursor; using osu.Framework.Graphics.Cursor;
using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Sprites;
using osu.Framework.Localisation;
using osu.Game.Beatmaps; using osu.Game.Beatmaps;
using osu.Game.Graphics.UserInterface; using osu.Game.Graphics.UserInterface;
using osu.Game.Online.API; using osu.Game.Online.API;
@ -28,7 +29,7 @@ namespace osu.Game.Overlays.BeatmapSet.Buttons
private readonly IBindable<User> localUser = new Bindable<User>(); private readonly IBindable<User> localUser = new Bindable<User>();
public string TooltipText public LocalisableString TooltipText
{ {
get get
{ {

View File

@ -7,6 +7,7 @@ using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Cursor; using osu.Framework.Graphics.Cursor;
using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Sprites;
using osu.Framework.Localisation;
using osu.Game.Beatmaps; using osu.Game.Beatmaps;
using osu.Game.Graphics; using osu.Game.Graphics;
using osu.Game.Graphics.Containers; using osu.Game.Graphics.Containers;
@ -26,7 +27,7 @@ namespace osu.Game.Overlays.BeatmapSet.Buttons
private readonly bool noVideo; private readonly bool noVideo;
public string TooltipText => button.Enabled.Value ? "download this beatmap" : "login to download"; public LocalisableString TooltipText => button.Enabled.Value ? "download this beatmap" : "login to download";
private readonly IBindable<User> localUser = new Bindable<User>(); private readonly IBindable<User> localUser = new Bindable<User>();

View File

@ -20,6 +20,7 @@ using System;
using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Shapes;
using osu.Framework.Extensions.IEnumerableExtensions; using osu.Framework.Extensions.IEnumerableExtensions;
using System.Collections.Specialized; using System.Collections.Specialized;
using osu.Framework.Localisation;
using osu.Game.Overlays.Comments.Buttons; using osu.Game.Overlays.Comments.Buttons;
namespace osu.Game.Overlays.Comments namespace osu.Game.Overlays.Comments
@ -395,7 +396,7 @@ namespace osu.Game.Overlays.Comments
private class ParentUsername : FillFlowContainer, IHasTooltip private class ParentUsername : FillFlowContainer, IHasTooltip
{ {
public string TooltipText => getParentMessage(); public LocalisableString TooltipText => getParentMessage();
private readonly Comment parentComment; private readonly Comment parentComment;
@ -427,7 +428,7 @@ namespace osu.Game.Overlays.Comments
if (parentComment == null) if (parentComment == null)
return string.Empty; return string.Empty;
return parentComment.HasMessage ? parentComment.Message : parentComment.IsDeleted ? @"deleted" : string.Empty; return parentComment.HasMessage ? parentComment.Message : parentComment.IsDeleted ? "deleted" : string.Empty;
} }
} }
} }

View File

@ -14,6 +14,7 @@ using System;
using System.Linq; using System.Linq;
using osu.Framework.Graphics.Cursor; using osu.Framework.Graphics.Cursor;
using osu.Framework.Input.Events; using osu.Framework.Input.Events;
using osu.Framework.Localisation;
using osu.Game.Graphics; using osu.Game.Graphics;
using osu.Game.Graphics.UserInterface; using osu.Game.Graphics.UserInterface;
@ -34,7 +35,7 @@ namespace osu.Game.Overlays.Mods
/// </summary> /// </summary>
public Action<Mod> SelectionChanged; public Action<Mod> SelectionChanged;
public string TooltipText => (SelectedMod?.Description ?? Mods.FirstOrDefault()?.Description) ?? string.Empty; public LocalisableString TooltipText => (SelectedMod?.Description ?? Mods.FirstOrDefault()?.Description) ?? string.Empty;
private const Easing mod_switch_easing = Easing.InOutSine; private const Easing mod_switch_easing = Easing.InOutSine;
private const double mod_switch_duration = 120; private const double mod_switch_duration = 120;

View File

@ -11,6 +11,7 @@ using osu.Game.Graphics.UserInterface;
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osuTK.Graphics; using osuTK.Graphics;
using osu.Framework.Graphics.Cursor; using osu.Framework.Graphics.Cursor;
using osu.Framework.Localisation;
namespace osu.Game.Overlays namespace osu.Game.Overlays
{ {
@ -56,7 +57,7 @@ namespace osu.Game.Overlays
[Resolved] [Resolved]
private OverlayColourProvider colourProvider { get; set; } private OverlayColourProvider colourProvider { get; set; }
public string TooltipText => $@"{Value} view"; public LocalisableString TooltipText => $@"{Value} view";
private readonly SpriteIcon icon; private readonly SpriteIcon icon;

View File

@ -7,6 +7,7 @@ using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Cursor; using osu.Framework.Graphics.Cursor;
using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.Textures; using osu.Framework.Graphics.Textures;
using osu.Framework.Localisation;
using osu.Game.Users; using osu.Game.Users;
using osuTK; using osuTK;
@ -42,6 +43,6 @@ namespace osu.Game.Overlays.Profile.Header.Components
InternalChild.FadeInFromZero(200); InternalChild.FadeInFromZero(200);
} }
public string TooltipText => badge.Description; public LocalisableString TooltipText => badge.Description;
} }
} }

View File

@ -6,6 +6,7 @@ using osu.Framework.Bindables;
using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Sprites;
using osu.Framework.Localisation;
using osuTK; using osuTK;
namespace osu.Game.Overlays.Profile.Header.Components namespace osu.Game.Overlays.Profile.Header.Components
@ -14,7 +15,7 @@ namespace osu.Game.Overlays.Profile.Header.Components
{ {
public readonly BindableBool DetailsVisible = new BindableBool(); public readonly BindableBool DetailsVisible = new BindableBool();
public override string TooltipText => DetailsVisible.Value ? "collapse" : "expand"; public override LocalisableString TooltipText => DetailsVisible.Value ? "collapse" : "expand";
private SpriteIcon icon; private SpriteIcon icon;

View File

@ -4,6 +4,7 @@
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Bindables; using osu.Framework.Bindables;
using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Sprites;
using osu.Framework.Localisation;
using osu.Game.Users; using osu.Game.Users;
namespace osu.Game.Overlays.Profile.Header.Components namespace osu.Game.Overlays.Profile.Header.Components
@ -12,7 +13,7 @@ namespace osu.Game.Overlays.Profile.Header.Components
{ {
public readonly Bindable<User> User = new Bindable<User>(); public readonly Bindable<User> User = new Bindable<User>();
public override string TooltipText => "followers"; public override LocalisableString TooltipText => "followers";
protected override IconUsage Icon => FontAwesome.Solid.User; protected override IconUsage Icon => FontAwesome.Solid.User;

View File

@ -8,6 +8,7 @@ using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Cursor; using osu.Framework.Graphics.Cursor;
using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.Textures; using osu.Framework.Graphics.Textures;
using osu.Framework.Localisation;
using osu.Game.Graphics; using osu.Game.Graphics;
using osu.Game.Graphics.Sprites; using osu.Game.Graphics.Sprites;
using osu.Game.Users; using osu.Game.Users;
@ -18,7 +19,7 @@ namespace osu.Game.Overlays.Profile.Header.Components
{ {
public readonly Bindable<User> User = new Bindable<User>(); public readonly Bindable<User> User = new Bindable<User>();
public string TooltipText { get; } public LocalisableString TooltipText { get; }
private OsuSpriteText levelText; private OsuSpriteText levelText;

View File

@ -6,6 +6,7 @@ using osu.Framework.Bindables;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Cursor; using osu.Framework.Graphics.Cursor;
using osu.Framework.Localisation;
using osu.Game.Graphics; using osu.Game.Graphics;
using osu.Game.Graphics.Sprites; using osu.Game.Graphics.Sprites;
using osu.Game.Graphics.UserInterface; using osu.Game.Graphics.UserInterface;
@ -18,7 +19,7 @@ namespace osu.Game.Overlays.Profile.Header.Components
{ {
public readonly Bindable<User> User = new Bindable<User>(); public readonly Bindable<User> User = new Bindable<User>();
public string TooltipText { get; } public LocalisableString TooltipText { get; }
private Bar levelProgressBar; private Bar levelProgressBar;
private OsuSpriteText levelProgressText; private OsuSpriteText levelProgressText;

View File

@ -4,6 +4,7 @@
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Bindables; using osu.Framework.Bindables;
using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Sprites;
using osu.Framework.Localisation;
using osu.Game.Users; using osu.Game.Users;
namespace osu.Game.Overlays.Profile.Header.Components namespace osu.Game.Overlays.Profile.Header.Components
@ -12,7 +13,7 @@ namespace osu.Game.Overlays.Profile.Header.Components
{ {
public readonly Bindable<User> User = new Bindable<User>(); public readonly Bindable<User> User = new Bindable<User>();
public override string TooltipText => "mapping subscribers"; public override LocalisableString TooltipText => "mapping subscribers";
protected override IconUsage Icon => FontAwesome.Solid.Bell; protected override IconUsage Icon => FontAwesome.Solid.Bell;

View File

@ -5,6 +5,7 @@ using osu.Framework.Allocation;
using osu.Framework.Bindables; using osu.Framework.Bindables;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Sprites;
using osu.Framework.Localisation;
using osu.Game.Online.API; using osu.Game.Online.API;
using osu.Game.Online.Chat; using osu.Game.Online.Chat;
using osu.Game.Users; using osu.Game.Users;
@ -16,7 +17,7 @@ namespace osu.Game.Overlays.Profile.Header.Components
{ {
public readonly Bindable<User> User = new Bindable<User>(); public readonly Bindable<User> User = new Bindable<User>();
public override string TooltipText => "send message"; public override LocalisableString TooltipText => "send message";
[Resolved(CanBeNull = true)] [Resolved(CanBeNull = true)]
private ChannelManager channelManager { get; set; } private ChannelManager channelManager { get; set; }

View File

@ -6,6 +6,7 @@ using osu.Framework.Bindables;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Cursor; using osu.Framework.Graphics.Cursor;
using osu.Framework.Localisation;
using osu.Game.Users; using osu.Game.Users;
namespace osu.Game.Overlays.Profile.Header.Components namespace osu.Game.Overlays.Profile.Header.Components
@ -14,7 +15,7 @@ namespace osu.Game.Overlays.Profile.Header.Components
{ {
public readonly Bindable<User> User = new Bindable<User>(); public readonly Bindable<User> User = new Bindable<User>();
public string TooltipText { get; set; } public LocalisableString TooltipText { get; set; }
private OverlinedInfoContainer info; private OverlinedInfoContainer info;

View File

@ -8,6 +8,7 @@ using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Cursor; using osu.Framework.Graphics.Cursor;
using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Shapes;
using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Sprites;
using osu.Framework.Localisation;
using osu.Game.Graphics; using osu.Game.Graphics;
namespace osu.Game.Overlays.Profile.Header.Components namespace osu.Game.Overlays.Profile.Header.Components
@ -18,7 +19,7 @@ namespace osu.Game.Overlays.Profile.Header.Components
private readonly FillFlowContainer iconContainer; private readonly FillFlowContainer iconContainer;
private readonly CircularContainer content; private readonly CircularContainer content;
public string TooltipText => "osu!supporter"; public LocalisableString TooltipText => "osu!supporter";
public int SupportLevel public int SupportLevel
{ {

View File

@ -143,7 +143,7 @@ namespace osu.Game.Overlays.Profile.Sections.Historical
private class PlayCountText : CompositeDrawable, IHasTooltip private class PlayCountText : CompositeDrawable, IHasTooltip
{ {
public string TooltipText => "times played"; public LocalisableString TooltipText => "times played";
public PlayCountText(int playCount) public PlayCountText(int playCount)
{ {

View File

@ -10,6 +10,7 @@ using osu.Framework.Graphics.Cursor;
using osu.Framework.Graphics.Effects; using osu.Framework.Graphics.Effects;
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; using osu.Game.Graphics;
using osu.Game.Graphics.UserInterface; using osu.Game.Graphics.UserInterface;
@ -76,7 +77,7 @@ namespace osu.Game.Overlays
UpdateState(); UpdateState();
} }
public string TooltipText => "revert to default"; public LocalisableString TooltipText => "revert to default";
protected override bool OnHover(HoverEvent e) protected override bool OnHover(HoverEvent e)
{ {

View File

@ -3,6 +3,7 @@
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Localisation;
using osu.Game.Configuration; using osu.Game.Configuration;
using osu.Game.Graphics.UserInterface; using osu.Game.Graphics.UserInterface;
@ -32,7 +33,7 @@ namespace osu.Game.Overlays.Settings.Sections.Audio
private class OffsetSlider : OsuSliderBar<double> private class OffsetSlider : OsuSliderBar<double>
{ {
public override string TooltipText => Current.Value.ToString(@"0ms"); public override LocalisableString TooltipText => Current.Value.ToString(@"0ms");
} }
} }
} }

View File

@ -233,7 +233,7 @@ namespace osu.Game.Overlays.Settings.Sections.Graphics
private class UIScaleSlider : OsuSliderBar<float> private class UIScaleSlider : OsuSliderBar<float>
{ {
public override string TooltipText => base.TooltipText + "x"; public override LocalisableString TooltipText => base.TooltipText + "x";
} }
private class ResolutionSettingsDropdown : SettingsDropdown<Size> private class ResolutionSettingsDropdown : SettingsDropdown<Size>

View File

@ -6,6 +6,7 @@ using osu.Framework.Bindables;
using osu.Framework.Configuration; using osu.Framework.Configuration;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Input.Handlers.Mouse; using osu.Framework.Input.Handlers.Mouse;
using osu.Framework.Localisation;
using osu.Game.Configuration; using osu.Game.Configuration;
using osu.Game.Graphics.UserInterface; using osu.Game.Graphics.UserInterface;
using osu.Game.Input; using osu.Game.Input;
@ -116,7 +117,7 @@ namespace osu.Game.Overlays.Settings.Sections.Input
private class SensitivitySlider : OsuSliderBar<double> private class SensitivitySlider : OsuSliderBar<double>
{ {
public override string TooltipText => Current.Disabled ? "enable high precision mouse to adjust sensitivity" : $"{base.TooltipText}x"; public override LocalisableString TooltipText => Current.Disabled ? "enable high precision mouse to adjust sensitivity" : $"{base.TooltipText}x";
} }
} }
} }

View File

@ -1,6 +1,7 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // 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. // See the LICENCE file in the repository root for full licence text.
using osu.Framework.Localisation;
using osu.Game.Graphics.UserInterface; using osu.Game.Graphics.UserInterface;
namespace osu.Game.Overlays.Settings.Sections namespace osu.Game.Overlays.Settings.Sections
@ -10,6 +11,6 @@ namespace osu.Game.Overlays.Settings.Sections
/// </summary> /// </summary>
internal class SizeSlider : OsuSliderBar<float> internal class SizeSlider : OsuSliderBar<float>
{ {
public override string TooltipText => Current.Value.ToString(@"0.##x"); public override LocalisableString TooltipText => Current.Value.ToString(@"0.##x");
} }
} }

View File

@ -3,6 +3,7 @@
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Localisation;
using osu.Game.Configuration; using osu.Game.Configuration;
using osu.Game.Graphics.UserInterface; using osu.Game.Graphics.UserInterface;
@ -44,7 +45,7 @@ namespace osu.Game.Overlays.Settings.Sections.UserInterface
private class TimeSlider : OsuSliderBar<float> private class TimeSlider : OsuSliderBar<float>
{ {
public override string TooltipText => Current.Value.ToString("N0") + "ms"; public override LocalisableString TooltipText => Current.Value.ToString(@"N0") + "ms";
} }
} }
} }

View File

@ -5,6 +5,7 @@ using System;
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Bindables; using osu.Framework.Bindables;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Localisation;
using osu.Game.Configuration; using osu.Game.Configuration;
using osu.Game.Graphics.UserInterface; using osu.Game.Graphics.UserInterface;
@ -62,12 +63,12 @@ namespace osu.Game.Overlays.Settings.Sections.UserInterface
private class MaximumStarsSlider : StarsSlider private class MaximumStarsSlider : StarsSlider
{ {
public override string TooltipText => Current.IsDefault ? "no limit" : base.TooltipText; public override LocalisableString TooltipText => Current.IsDefault ? "no limit" : base.TooltipText;
} }
private class StarsSlider : OsuSliderBar<double> private class StarsSlider : OsuSliderBar<double>
{ {
public override string TooltipText => Current.Value.ToString(@"0.## stars"); public override LocalisableString TooltipText => Current.Value.ToString(@"0.## stars");
} }
} }
} }

View File

@ -5,6 +5,7 @@ using System.Collections.Generic;
using System.Linq; using System.Linq;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Cursor; using osu.Framework.Graphics.Cursor;
using osu.Framework.Localisation;
using osu.Game.Graphics.UserInterface; using osu.Game.Graphics.UserInterface;
namespace osu.Game.Overlays.Settings namespace osu.Game.Overlays.Settings
@ -17,14 +18,15 @@ namespace osu.Game.Overlays.Settings
Padding = new MarginPadding { Left = SettingsPanel.CONTENT_MARGINS, Right = SettingsPanel.CONTENT_MARGINS }; Padding = new MarginPadding { Left = SettingsPanel.CONTENT_MARGINS, Right = SettingsPanel.CONTENT_MARGINS };
} }
public string TooltipText { get; set; } public LocalisableString TooltipText { get; set; }
public override IEnumerable<string> FilterTerms public override IEnumerable<string> FilterTerms
{ {
get get
{ {
if (TooltipText != null) if (TooltipText != default)
return base.FilterTerms.Append(TooltipText); // TODO: this won't work as intended once the tooltip text is translated.
return base.FilterTerms.Append(TooltipText.ToString());
return base.FilterTerms; return base.FilterTerms;
} }

View File

@ -35,7 +35,7 @@ namespace osu.Game.Overlays.Settings
public bool ShowsDefaultIndicator = true; public bool ShowsDefaultIndicator = true;
public string TooltipText { get; set; } public LocalisableString TooltipText { get; set; }
[Resolved] [Resolved]
private OsuColour colours { get; set; } private OsuColour colours { get; set; }
@ -142,4 +142,4 @@ namespace osu.Game.Overlays.Settings
labelText.Alpha = controlWithCurrent.Current.Disabled ? 0.3f : 1; labelText.Alpha = controlWithCurrent.Current.Disabled ? 0.3f : 1;
} }
} }
} }

View File

@ -13,6 +13,7 @@ using osu.Game.Graphics.Sprites;
using osu.Game.Rulesets.Mods; using osu.Game.Rulesets.Mods;
using osuTK; using osuTK;
using osu.Framework.Bindables; using osu.Framework.Bindables;
using osu.Framework.Localisation;
namespace osu.Game.Rulesets.UI namespace osu.Game.Rulesets.UI
{ {
@ -29,7 +30,7 @@ namespace osu.Game.Rulesets.UI
private const float size = 80; private const float size = 80;
public virtual string TooltipText => showTooltip ? mod.IconTooltip : null; public virtual LocalisableString TooltipText => showTooltip ? mod.IconTooltip : null;
private Mod mod; private Mod mod;
private readonly bool showTooltip; private readonly bool showTooltip;

View File

@ -7,6 +7,7 @@ using osu.Framework.Graphics;
using osu.Framework.Graphics.Cursor; using osu.Framework.Graphics.Cursor;
using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Sprites;
using osu.Framework.Input.Events; using osu.Framework.Input.Events;
using osu.Framework.Localisation;
using osuTK; using osuTK;
using osuTK.Graphics; using osuTK.Graphics;
@ -58,6 +59,6 @@ namespace osu.Game.Screens.Edit.Compose.Components
icon.FadeColour(!IsHeld && IsHovered ? Color4.White : Color4.Black, TRANSFORM_DURATION, Easing.OutQuint); icon.FadeColour(!IsHeld && IsHovered ? Color4.White : Color4.Black, TRANSFORM_DURATION, Easing.OutQuint);
} }
public string TooltipText { get; } public LocalisableString TooltipText { get; }
} }
} }

View File

@ -7,6 +7,7 @@ using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Cursor; using osu.Framework.Graphics.Cursor;
using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Shapes;
using osu.Framework.Localisation;
using osu.Game.Graphics; using osu.Game.Graphics;
using osu.Game.Online.Rooms; using osu.Game.Online.Rooms;
@ -16,7 +17,7 @@ namespace osu.Game.Screens.OnlinePlay.Components
{ {
private readonly GameType type; private readonly GameType type;
public string TooltipText => type.Name; public LocalisableString TooltipText => type.Name;
public DrawableGameType(GameType type) public DrawableGameType(GameType type)
{ {

View File

@ -431,7 +431,7 @@ namespace osu.Game.Screens.Select
public class InfoLabel : Container, IHasTooltip public class InfoLabel : Container, IHasTooltip
{ {
public string TooltipText { get; } public LocalisableString TooltipText { get; }
public InfoLabel(BeatmapStatistic statistic) public InfoLabel(BeatmapStatistic statistic)
{ {

View File

@ -6,6 +6,7 @@ using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Textures; using osu.Framework.Graphics.Textures;
using osu.Framework.Input.Events; using osu.Framework.Input.Events;
using osu.Framework.Localisation;
using osu.Game.Graphics.Containers; using osu.Game.Graphics.Containers;
namespace osu.Game.Users.Drawables namespace osu.Game.Users.Drawables
@ -68,11 +69,11 @@ namespace osu.Game.Users.Drawables
private class ClickableArea : OsuClickableContainer private class ClickableArea : OsuClickableContainer
{ {
private string tooltip = default_tooltip_text; private LocalisableString tooltip = default_tooltip_text;
public override string TooltipText public override LocalisableString TooltipText
{ {
get => Enabled.Value ? tooltip : null; get => Enabled.Value ? tooltip : default;
set => tooltip = value; set => tooltip = value;
} }

View File

@ -6,6 +6,7 @@ using osu.Framework.Allocation;
using osu.Framework.Graphics.Cursor; using osu.Framework.Graphics.Cursor;
using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.Textures; using osu.Framework.Graphics.Textures;
using osu.Framework.Localisation;
namespace osu.Game.Users.Drawables namespace osu.Game.Users.Drawables
{ {
@ -13,7 +14,7 @@ namespace osu.Game.Users.Drawables
{ {
private readonly Country country; private readonly Country country;
public string TooltipText => country?.FullName; public LocalisableString TooltipText => country?.FullName;
public DrawableFlag(Country country) public DrawableFlag(Country country)
{ {