1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-11 16:27:26 +08:00

Replace 2 strings with one formattable

This commit is contained in:
ansel 2023-01-17 13:31:03 +03:00
parent ad32d99daa
commit df74bccaaa
2 changed files with 10 additions and 11 deletions

View File

@ -52,21 +52,16 @@ namespace osu.Game.Localisation
public static LocalisableString MakeSureToGetIt => new TranslatableString(getKey(@"make_sure_to_get_it"), @" Make sure to get it right!");
/// <summary>
/// "At least "
/// "At least {0}. Choose something long but also something you will remember, like a line from your favourite song."
/// </summary>
public static LocalisableString BeforeCharactersLong => new TranslatableString(getKey(@"before_characters_long"), @"At least ");
public static LocalisableString PasswordRequirements(string arg0) => new TranslatableString(getKey(@"password_requirements"),
@"At least {0}. Choose something long but also something you will remember, like a line from your favourite song.", arg0);
/// <summary>
/// "8 characters long"
/// </summary>
public static LocalisableString CharactersLong => new TranslatableString(getKey(@"characters_long"), @"8 characters long");
/// <summary>
/// ". Choose something long but also something you will remember, like a line from your favourite song."
/// </summary>
public static LocalisableString AfterCharactersLong =>
new TranslatableString(getKey(@"after_characters_long"), @". Choose something long but also something you will remember, like a line from your favourite song.");
private static string getKey(string key) => $@"{prefix}:{key}";
}
}

View File

@ -10,6 +10,7 @@ using osu.Framework.Allocation;
using osu.Framework.Extensions.LocalisationExtensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Localisation;
using osu.Framework.Utils;
using osu.Framework.Platform;
using osu.Framework.Screens;
@ -52,7 +53,7 @@ namespace osu.Game.Overlays.AccountCreation
private OsuGame game { get; set; }
[BackgroundDependencyLoader]
private void load()
private void load(LocalisationManager localisationManager)
{
InternalChildren = new Drawable[]
{
@ -138,9 +139,12 @@ namespace osu.Game.Overlays.AccountCreation
emailAddressDescription.AddText(AccountCreationStrings.EmailUsage);
emailAddressDescription.AddText(AccountCreationStrings.MakeSureToGetIt, cp => cp.Font = cp.Font.With(Typeface.Torus, weight: FontWeight.Bold));
passwordDescription.AddText(AccountCreationStrings.BeforeCharactersLong);
string[] passwordReq = localisationManager.GetLocalisedBindableString(AccountCreationStrings.PasswordRequirements("{}")).Value.Split("{}");
if (passwordReq.Length != 2) passwordReq = AccountCreationStrings.PasswordRequirements("{}").ToString().Split("{}");
passwordDescription.AddText(passwordReq[0]);
characterCheckText = passwordDescription.AddText(AccountCreationStrings.CharactersLong);
passwordDescription.AddText(AccountCreationStrings.AfterCharactersLong);
passwordDescription.AddText(passwordReq[1]);
passwordTextBox.Current.BindValueChanged(_ => updateCharacterCheckTextColour(), true);
characterCheckText.DrawablePartsRecreated += _ => updateCharacterCheckTextColour();