1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-15 05:02:55 +08:00

Allow localisable strings

This commit is contained in:
ansel 2022-11-29 05:13:54 +03:00
parent 61bfd2f6b2
commit 8b033bf9f7
2 changed files with 13 additions and 11 deletions

View File

@ -8,6 +8,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.Containers; using osu.Framework.Graphics.Containers;
using osu.Framework.Localisation;
using osu.Game.Overlays; using osu.Game.Overlays;
using osu.Game.Overlays.Comments; using osu.Game.Overlays.Comments;
using osuTK; using osuTK;
@ -121,15 +122,15 @@ namespace osu.Game.Tests.Visual.UserInterface
Scheduler.AddDelayed(() => IsLoading = false, 1000); Scheduler.AddDelayed(() => IsLoading = false, 1000);
} }
protected override string FooterText => @"Footer text. And it is pretty long. Cool."; protected override LocalisableString FooterText => @"Footer text. And it is pretty long. Cool.";
protected override string CommitButtonText => @"Commit"; protected override LocalisableString CommitButtonText => @"Commit";
protected override string TextBoxPlaceholder => @"This text box is empty"; protected override LocalisableString TextBoxPlaceholder => @"This text box is empty";
} }
private partial class TestCancellableCommentEditor : CancellableCommentEditor private partial class TestCancellableCommentEditor : CancellableCommentEditor
{ {
public new FillFlowContainer ButtonsContainer => base.ButtonsContainer; public new FillFlowContainer ButtonsContainer => base.ButtonsContainer;
protected override string FooterText => @"Wow, another one. Sicc"; protected override LocalisableString FooterText => @"Wow, another one. Sicc";
public bool Cancelled { get; private set; } public bool Cancelled { get; private set; }
@ -138,8 +139,8 @@ namespace osu.Game.Tests.Visual.UserInterface
OnCancel = () => Cancelled = true; OnCancel = () => Cancelled = true;
} }
protected override string CommitButtonText => @"Save"; protected override LocalisableString CommitButtonText => @"Save";
protected override string TextBoxPlaceholder => @"Multiline textboxes soon"; protected override LocalisableString TextBoxPlaceholder => @"Multiline textboxes soon";
} }
} }
} }

View File

@ -17,6 +17,7 @@ using System.Collections.Generic;
using System; using System;
using osuTK; using osuTK;
using osu.Framework.Bindables; using osu.Framework.Bindables;
using osu.Framework.Localisation;
namespace osu.Game.Overlays.Comments namespace osu.Game.Overlays.Comments
{ {
@ -32,11 +33,11 @@ namespace osu.Game.Overlays.Comments
set => commitButton.IsLoading = value; set => commitButton.IsLoading = value;
} }
protected abstract string FooterText { get; } protected abstract LocalisableString FooterText { get; }
protected abstract string CommitButtonText { get; } protected abstract LocalisableString CommitButtonText { get; }
protected abstract string TextBoxPlaceholder { get; } protected abstract LocalisableString TextBoxPlaceholder { get; }
protected FillFlowContainer ButtonsContainer { get; private set; } protected FillFlowContainer ButtonsContainer { get; private set; }
@ -177,7 +178,7 @@ namespace osu.Game.Overlays.Comments
protected override IEnumerable<Drawable> EffectTargets => new[] { background }; protected override IEnumerable<Drawable> EffectTargets => new[] { background };
private readonly string text; private readonly LocalisableString text;
[Resolved] [Resolved]
private OverlayColourProvider colourProvider { get; set; } private OverlayColourProvider colourProvider { get; set; }
@ -186,7 +187,7 @@ namespace osu.Game.Overlays.Comments
private Box background; private Box background;
private Box blockedBackground; private Box blockedBackground;
public CommitButton(string text) public CommitButton(LocalisableString text)
{ {
this.text = text; this.text = text;