From 4c341db33f12a05a1ec6e4abbf60fd4294b0a70d Mon Sep 17 00:00:00 2001 From: ansel <79257300125@ya.ru> Date: Mon, 16 Jan 2023 21:31:01 +0300 Subject: [PATCH] Localise registration window --- .../Localisation/AccountCreationStrings.cs | 77 +++++++++++++++++++ .../Overlays/AccountCreation/ScreenEntry.cs | 19 ++--- .../Overlays/AccountCreation/ScreenWarning.cs | 5 +- .../Overlays/AccountCreation/ScreenWelcome.cs | 9 +-- 4 files changed, 94 insertions(+), 16 deletions(-) create mode 100644 osu.Game/Localisation/AccountCreationStrings.cs diff --git a/osu.Game/Localisation/AccountCreationStrings.cs b/osu.Game/Localisation/AccountCreationStrings.cs new file mode 100644 index 0000000000..4e702ea7cc --- /dev/null +++ b/osu.Game/Localisation/AccountCreationStrings.cs @@ -0,0 +1,77 @@ +// Copyright (c) ppy Pty Ltd . 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 AccountCreationStrings + { + private const string prefix = @"osu.Game.Resources.Localisation.AccountCreation"; + + /// + /// "New Player Registration" + /// + public static LocalisableString NewPlayerRegistration => new TranslatableString(getKey(@"new_player_registration"), @"New Player Registration"); + + /// + /// "let's get you started" + /// + public static LocalisableString LetsGetYouStarted => new TranslatableString(getKey(@"lets_get_you_started"), @"let's get you started"); + + /// + /// "Let's create an account!" + /// + public static LocalisableString LetsCreateAnAccount => new TranslatableString(getKey(@"lets_create_an_account"), @"Let's create an account!"); + + /// + /// "Help, I can't access my account!" + /// + public static LocalisableString HelpICantAccess => new TranslatableString(getKey(@"help_icant_access"), @"Help, I can't access my account!"); + + /// + /// "I understand. This account isn't for me." + /// + public static LocalisableString AccountIsntForMe => new TranslatableString(getKey(@"account_isnt_for_me"), @"I understand. This account isn't for me."); + + /// + /// "email address" + /// + public static LocalisableString EmailAddress => new TranslatableString(getKey(@"email_address"), @"email address"); + + /// + /// "This will be your public presence. No profanity, no impersonation. Avoid exposing your own personal details, too!" + /// + public static LocalisableString ThisWillBeYourPublic => new TranslatableString(getKey(@"this_will_be_your_public"), + @"This will be your public presence. No profanity, no impersonation. Avoid exposing your own personal details, too!"); + + /// + /// "Will be used for notifications, account verification and in the case you forget your password. No spam, ever." + /// + public static LocalisableString EmailUsage => + new TranslatableString(getKey(@"email_usage"), @"Will be used for notifications, account verification and in the case you forget your password. No spam, ever."); + + /// + /// " Make sure to get it right!" + /// + public static LocalisableString MakeSureToGetIt => new TranslatableString(getKey(@"make_sure_to_get_it"), @" Make sure to get it right!"); + + /// + /// "At least " + /// + public static LocalisableString BeforeCharactersLong => new TranslatableString(getKey(@"before_characters_long"), @"At least "); + + /// + /// "8 characters long" + /// + public static LocalisableString CharactersLong => new TranslatableString(getKey(@"characters_long"), @"8 characters long"); + + /// + /// ". Choose something long but also something you will remember, like a line from your favourite song." + /// + 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}"; + } +} diff --git a/osu.Game/Overlays/AccountCreation/ScreenEntry.cs b/osu.Game/Overlays/AccountCreation/ScreenEntry.cs index 2e20f83e9e..6718b72805 100644 --- a/osu.Game/Overlays/AccountCreation/ScreenEntry.cs +++ b/osu.Game/Overlays/AccountCreation/ScreenEntry.cs @@ -17,6 +17,7 @@ using osu.Game.Graphics; using osu.Game.Graphics.Containers; using osu.Game.Graphics.Sprites; using osu.Game.Graphics.UserInterface; +using osu.Game.Localisation; using osu.Game.Online.API; using osu.Game.Overlays.Settings; using osu.Game.Resources.Localisation.Web; @@ -71,7 +72,7 @@ namespace osu.Game.Overlays.AccountCreation Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, Font = OsuFont.GetFont(size: 20), - Text = "Let's create an account!", + Text = AccountCreationStrings.LetsCreateAnAccount }, usernameTextBox = new OsuTextBox { @@ -86,7 +87,7 @@ namespace osu.Game.Overlays.AccountCreation }, emailTextBox = new OsuTextBox { - PlaceholderText = "email address", + PlaceholderText = AccountCreationStrings.EmailAddress, RelativeSizeAxes = Axes.X, TabbableContentContainer = this }, @@ -118,7 +119,7 @@ namespace osu.Game.Overlays.AccountCreation AutoSizeAxes = Axes.Y, Child = new SettingsButton { - Text = "Register", + Text = LoginPanelStrings.Register, Margin = new MarginPadding { Vertical = 20 }, Action = performRegistration } @@ -132,14 +133,14 @@ namespace osu.Game.Overlays.AccountCreation textboxes = new[] { usernameTextBox, emailTextBox, passwordTextBox }; - usernameDescription.AddText("This will be your public presence. No profanity, no impersonation. Avoid exposing your own personal details, too!"); + usernameDescription.AddText(AccountCreationStrings.ThisWillBeYourPublic); - emailAddressDescription.AddText("Will be used for notifications, account verification and in the case you forget your password. No spam, ever."); - emailAddressDescription.AddText(" Make sure to get it right!", cp => cp.Font = cp.Font.With(Typeface.Torus, weight: FontWeight.Bold)); + emailAddressDescription.AddText(AccountCreationStrings.EmailUsage); + emailAddressDescription.AddText(AccountCreationStrings.MakeSureToGetIt, cp => cp.Font = cp.Font.With(Typeface.Torus, weight: FontWeight.Bold)); - passwordDescription.AddText("At least "); - characterCheckText = passwordDescription.AddText("8 characters long"); - passwordDescription.AddText(". Choose something long but also something you will remember, like a line from your favourite song."); + passwordDescription.AddText(AccountCreationStrings.BeforeCharactersLong); + characterCheckText = passwordDescription.AddText(AccountCreationStrings.CharactersLong); + passwordDescription.AddText(AccountCreationStrings.AfterCharactersLong); passwordTextBox.Current.BindValueChanged(_ => updateCharacterCheckTextColour(), true); characterCheckText.DrawablePartsRecreated += _ => updateCharacterCheckTextColour(); diff --git a/osu.Game/Overlays/AccountCreation/ScreenWarning.cs b/osu.Game/Overlays/AccountCreation/ScreenWarning.cs index a833a871f9..f5807b49b5 100644 --- a/osu.Game/Overlays/AccountCreation/ScreenWarning.cs +++ b/osu.Game/Overlays/AccountCreation/ScreenWarning.cs @@ -17,6 +17,7 @@ using osu.Game.Overlays.Settings; using osu.Game.Screens.Menu; using osuTK; using osuTK.Graphics; +using osu.Game.Localisation; namespace osu.Game.Overlays.AccountCreation { @@ -101,13 +102,13 @@ namespace osu.Game.Overlays.AccountCreation }, new SettingsButton { - Text = "Help, I can't access my account!", + Text = AccountCreationStrings.HelpICantAccess, Margin = new MarginPadding { Top = 50 }, Action = () => game?.OpenUrlExternally(help_centre_url) }, new DangerousSettingsButton { - Text = "I understand. This account isn't for me.", + Text = AccountCreationStrings.AccountIsntForMe, Action = () => this.Push(new ScreenEntry()) }, furtherAssistance = new LinkFlowContainer(cp => cp.Font = cp.Font.With(size: 12)) diff --git a/osu.Game/Overlays/AccountCreation/ScreenWelcome.cs b/osu.Game/Overlays/AccountCreation/ScreenWelcome.cs index 4becb225f8..a81b1019fe 100644 --- a/osu.Game/Overlays/AccountCreation/ScreenWelcome.cs +++ b/osu.Game/Overlays/AccountCreation/ScreenWelcome.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable disable - using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; @@ -12,6 +10,7 @@ using osu.Game.Graphics.Sprites; using osu.Game.Overlays.Settings; using osu.Game.Screens.Menu; using osuTK; +using osu.Game.Localisation; namespace osu.Game.Overlays.AccountCreation { @@ -46,18 +45,18 @@ namespace osu.Game.Overlays.AccountCreation Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, Font = OsuFont.GetFont(size: 24, weight: FontWeight.Light), - Text = "New Player Registration", + Text = AccountCreationStrings.NewPlayerRegistration, }, new OsuSpriteText { Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, Font = OsuFont.GetFont(size: 12), - Text = "let's get you started", + Text = AccountCreationStrings.LetsGetYouStarted, }, new SettingsButton { - Text = "Let's create an account!", + Text = AccountCreationStrings.LetsCreateAnAccount, Margin = new MarginPadding { Vertical = 120 }, Action = () => this.Push(new ScreenWarning()) }