1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-21 22:47:24 +08:00

Merge pull request #22239 from Feodor0090/registration-loc

Login and registration localisation
This commit is contained in:
Dean Herbert 2023-06-15 23:58:22 +09:00 committed by GitHub
commit e587d3f4f2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 140 additions and 29 deletions

View File

@ -16,6 +16,7 @@ using osu.Framework.Input;
using osu.Framework.Input.Events; using osu.Framework.Input.Events;
using osu.Framework.Localisation; using osu.Framework.Localisation;
using osu.Framework.Platform; using osu.Framework.Platform;
using osu.Game.Localisation;
namespace osu.Game.Graphics.UserInterface namespace osu.Game.Graphics.UserInterface
{ {
@ -112,7 +113,7 @@ namespace osu.Game.Graphics.UserInterface
private partial class CapsWarning : SpriteIcon, IHasTooltip private partial class CapsWarning : SpriteIcon, IHasTooltip
{ {
public LocalisableString TooltipText => "caps lock is active"; public LocalisableString TooltipText => CommonStrings.CapsLockIsActive;
public CapsWarning() public CapsWarning()
{ {

View File

@ -0,0 +1,54 @@
// 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
{
public static class AccountCreationStrings
{
private const string prefix = @"osu.Game.Resources.Localisation.AccountCreation";
/// <summary>
/// "New player registration"
/// </summary>
public static LocalisableString NewPlayerRegistration => new TranslatableString(getKey(@"new_player_registration"), @"New player registration");
/// <summary>
/// "Let&#39;s get you started"
/// </summary>
public static LocalisableString LetsGetYouStarted => new TranslatableString(getKey(@"lets_get_you_started"), @"Let's get you started");
/// <summary>
/// "Let&#39;s create an account!"
/// </summary>
public static LocalisableString LetsCreateAnAccount => new TranslatableString(getKey(@"lets_create_an_account"), @"Let's create an account!");
/// <summary>
/// "Help, I can&#39;t access my account!"
/// </summary>
public static LocalisableString MultiAccountWarningHelp => new TranslatableString(getKey(@"multi_account_warning_help"), @"Help, I can't access my account!");
/// <summary>
/// "I understand. This account isn&#39;t for me."
/// </summary>
public static LocalisableString MultiAccountWarningAccept => new TranslatableString(getKey(@"multi_account_warning_accept"), @"I understand. This account isn't for me.");
/// <summary>
/// "This will be your public presence. No profanity, no impersonation. Avoid exposing your own personal details, too!"
/// </summary>
public static LocalisableString UsernameDescription => new TranslatableString(getKey(@"username_description"), @"This will be your public presence. No profanity, no impersonation. Avoid exposing your own personal details, too!");
/// <summary>
/// "Will be used for notifications, account verification and in the case you forget your password. No spam, ever."
/// </summary>
public static LocalisableString EmailDescription1 => new TranslatableString(getKey(@"email_description_1"), @"Will be used for notifications, account verification and in the case you forget your password. No spam, ever.");
/// <summary>
/// " Make sure to get it right!"
/// </summary>
public static LocalisableString EmailDescription2 => new TranslatableString(getKey(@"email_description_2"), @" Make sure to get it right!");
private static string getKey(string key) => $@"{prefix}:{key}";
}
}

View File

@ -154,6 +154,11 @@ namespace osu.Game.Localisation
/// </summary> /// </summary>
public static LocalisableString Exit => new TranslatableString(getKey(@"exit"), @"Exit"); public static LocalisableString Exit => new TranslatableString(getKey(@"exit"), @"Exit");
/// <summary>
/// "Caps lock is active"
/// </summary>
public static LocalisableString CapsLockIsActive => new TranslatableString(getKey(@"caps_lock_is_active"), @"Caps lock is active");
/// <summary> /// <summary>
/// "Revert to default" /// "Revert to default"
/// </summary> /// </summary>

View File

@ -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
{
public static class LoginPanelStrings
{
private const string prefix = @"osu.Game.Resources.Localisation.LoginPanel";
/// <summary>
/// "Do not disturb"
/// </summary>
public static LocalisableString DoNotDisturb => new TranslatableString(getKey(@"do_not_disturb"), @"Do not disturb");
/// <summary>
/// "Appear offline"
/// </summary>
public static LocalisableString AppearOffline => new TranslatableString(getKey(@"appear_offline"), @"Appear offline");
/// <summary>
/// "Signed in"
/// </summary>
public static LocalisableString SignedIn => new TranslatableString(getKey(@"signed_in"), @"Signed in");
/// <summary>
/// "Account"
/// </summary>
public static LocalisableString Account => new TranslatableString(getKey(@"account"), @"Account");
/// <summary>
/// "Remember username"
/// </summary>
public static LocalisableString RememberUsername => new TranslatableString(getKey(@"remember_username"), @"Remember username");
/// <summary>
/// "Stay signed in"
/// </summary>
public static LocalisableString StaySignedIn => new TranslatableString(getKey(@"stay_signed_in"), @"Stay signed in");
/// <summary>
/// "Register"
/// </summary>
public static LocalisableString Register => new TranslatableString(getKey(@"register"), @"Register");
private static string getKey(string key) => $@"{prefix}:{key}";
}
}

View File

@ -17,6 +17,7 @@ using osu.Game.Graphics;
using osu.Game.Graphics.Containers; using osu.Game.Graphics.Containers;
using osu.Game.Graphics.Sprites; using osu.Game.Graphics.Sprites;
using osu.Game.Graphics.UserInterface; using osu.Game.Graphics.UserInterface;
using osu.Game.Localisation;
using osu.Game.Online.API; using osu.Game.Online.API;
using osu.Game.Overlays.Settings; using osu.Game.Overlays.Settings;
using osu.Game.Resources.Localisation.Web; using osu.Game.Resources.Localisation.Web;
@ -71,7 +72,7 @@ namespace osu.Game.Overlays.AccountCreation
Anchor = Anchor.TopCentre, Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre, Origin = Anchor.TopCentre,
Font = OsuFont.GetFont(size: 20), Font = OsuFont.GetFont(size: 20),
Text = "Let's create an account!", Text = AccountCreationStrings.LetsCreateAnAccount
}, },
usernameTextBox = new OsuTextBox usernameTextBox = new OsuTextBox
{ {
@ -86,7 +87,7 @@ namespace osu.Game.Overlays.AccountCreation
}, },
emailTextBox = new OsuTextBox emailTextBox = new OsuTextBox
{ {
PlaceholderText = "email address", PlaceholderText = ModelValidationStrings.UserAttributesUserEmail.ToLower(),
RelativeSizeAxes = Axes.X, RelativeSizeAxes = Axes.X,
TabbableContentContainer = this TabbableContentContainer = this
}, },
@ -118,7 +119,7 @@ namespace osu.Game.Overlays.AccountCreation
AutoSizeAxes = Axes.Y, AutoSizeAxes = Axes.Y,
Child = new SettingsButton Child = new SettingsButton
{ {
Text = "Register", Text = LoginPanelStrings.Register,
Margin = new MarginPadding { Vertical = 20 }, Margin = new MarginPadding { Vertical = 20 },
Action = performRegistration Action = performRegistration
} }
@ -132,10 +133,10 @@ namespace osu.Game.Overlays.AccountCreation
textboxes = new[] { usernameTextBox, emailTextBox, passwordTextBox }; 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.UsernameDescription);
emailAddressDescription.AddText("Will be used for notifications, account verification and in the case you forget your password. No spam, ever."); emailAddressDescription.AddText(AccountCreationStrings.EmailDescription1);
emailAddressDescription.AddText(" Make sure to get it right!", cp => cp.Font = cp.Font.With(Typeface.Torus, weight: FontWeight.Bold)); emailAddressDescription.AddText(AccountCreationStrings.EmailDescription2, cp => cp.Font = cp.Font.With(Typeface.Torus, weight: FontWeight.Bold));
passwordDescription.AddText("At least "); passwordDescription.AddText("At least ");
characterCheckText = passwordDescription.AddText("8 characters long"); characterCheckText = passwordDescription.AddText("8 characters long");

View File

@ -17,6 +17,7 @@ using osu.Game.Overlays.Settings;
using osu.Game.Screens.Menu; using osu.Game.Screens.Menu;
using osuTK; using osuTK;
using osuTK.Graphics; using osuTK.Graphics;
using osu.Game.Localisation;
namespace osu.Game.Overlays.AccountCreation namespace osu.Game.Overlays.AccountCreation
{ {
@ -101,13 +102,13 @@ namespace osu.Game.Overlays.AccountCreation
}, },
new SettingsButton new SettingsButton
{ {
Text = "Help, I can't access my account!", Text = AccountCreationStrings.MultiAccountWarningHelp,
Margin = new MarginPadding { Top = 50 }, Margin = new MarginPadding { Top = 50 },
Action = () => game?.OpenUrlExternally(help_centre_url) Action = () => game?.OpenUrlExternally(help_centre_url)
}, },
new DangerousSettingsButton new DangerousSettingsButton
{ {
Text = "I understand. This account isn't for me.", Text = AccountCreationStrings.MultiAccountWarningAccept,
Action = () => this.Push(new ScreenEntry()) Action = () => this.Push(new ScreenEntry())
}, },
furtherAssistance = new LinkFlowContainer(cp => cp.Font = cp.Font.With(size: 12)) furtherAssistance = new LinkFlowContainer(cp => cp.Font = cp.Font.With(size: 12))

View File

@ -1,9 +1,8 @@
// 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.
#nullable disable
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Extensions.LocalisationExtensions;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Framework.Screens; using osu.Framework.Screens;
@ -12,6 +11,7 @@ using osu.Game.Graphics.Sprites;
using osu.Game.Overlays.Settings; using osu.Game.Overlays.Settings;
using osu.Game.Screens.Menu; using osu.Game.Screens.Menu;
using osuTK; using osuTK;
using osu.Game.Localisation;
namespace osu.Game.Overlays.AccountCreation namespace osu.Game.Overlays.AccountCreation
{ {
@ -46,18 +46,18 @@ namespace osu.Game.Overlays.AccountCreation
Anchor = Anchor.TopCentre, Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre, Origin = Anchor.TopCentre,
Font = OsuFont.GetFont(size: 24, weight: FontWeight.Light), Font = OsuFont.GetFont(size: 24, weight: FontWeight.Light),
Text = "New Player Registration", Text = AccountCreationStrings.NewPlayerRegistration.ToTitle(),
}, },
new OsuSpriteText new OsuSpriteText
{ {
Anchor = Anchor.TopCentre, Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre, Origin = Anchor.TopCentre,
Font = OsuFont.GetFont(size: 12), Font = OsuFont.GetFont(size: 12),
Text = "let's get you started", Text = AccountCreationStrings.LetsGetYouStarted.ToLower(),
}, },
new SettingsButton new SettingsButton
{ {
Text = "Let's create an account!", Text = AccountCreationStrings.LetsCreateAnAccount,
Margin = new MarginPadding { Vertical = 120 }, Margin = new MarginPadding { Vertical = 120 },
Action = () => this.Push(new ScreenWarning()) Action = () => this.Push(new ScreenWarning())
} }

View File

@ -16,6 +16,7 @@ using osu.Game.Online.API;
using osu.Game.Overlays.Settings; using osu.Game.Overlays.Settings;
using osu.Game.Resources.Localisation.Web; using osu.Game.Resources.Localisation.Web;
using osuTK; using osuTK;
using osu.Game.Localisation;
namespace osu.Game.Overlays.Login namespace osu.Game.Overlays.Login
{ {
@ -47,7 +48,7 @@ namespace osu.Game.Overlays.Login
RelativeSizeAxes = Axes.X; RelativeSizeAxes = Axes.X;
ErrorTextFlowContainer errorText; ErrorTextFlowContainer errorText;
LinkFlowContainer forgottenPaswordLink; LinkFlowContainer forgottenPasswordLink;
Children = new Drawable[] Children = new Drawable[]
{ {
@ -71,15 +72,15 @@ namespace osu.Game.Overlays.Login
}, },
new SettingsCheckbox new SettingsCheckbox
{ {
LabelText = "Remember username", LabelText = LoginPanelStrings.RememberUsername,
Current = config.GetBindable<bool>(OsuSetting.SaveUsername), Current = config.GetBindable<bool>(OsuSetting.SaveUsername),
}, },
new SettingsCheckbox new SettingsCheckbox
{ {
LabelText = "Stay signed in", LabelText = LoginPanelStrings.StaySignedIn,
Current = config.GetBindable<bool>(OsuSetting.SavePassword), Current = config.GetBindable<bool>(OsuSetting.SavePassword),
}, },
forgottenPaswordLink = new LinkFlowContainer forgottenPasswordLink = new LinkFlowContainer
{ {
Padding = new MarginPadding { Left = SettingsPanel.CONTENT_MARGINS }, Padding = new MarginPadding { Left = SettingsPanel.CONTENT_MARGINS },
RelativeSizeAxes = Axes.X, RelativeSizeAxes = Axes.X,
@ -105,7 +106,7 @@ namespace osu.Game.Overlays.Login
}, },
new SettingsButton new SettingsButton
{ {
Text = "Register", Text = LoginPanelStrings.Register,
Action = () => Action = () =>
{ {
RequestHide?.Invoke(); RequestHide?.Invoke();
@ -114,7 +115,7 @@ namespace osu.Game.Overlays.Login
} }
}; };
forgottenPaswordLink.AddLink(LayoutStrings.PopupLoginLoginForgot, $"{api.WebsiteRootUrl}/home/password-reset"); forgottenPasswordLink.AddLink(LayoutStrings.PopupLoginLoginForgot, $"{api.WebsiteRootUrl}/home/password-reset");
password.OnCommit += (_, _) => performLogin(); password.OnCommit += (_, _) => performLogin();

View File

@ -6,6 +6,7 @@
using System; using System;
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Bindables; using osu.Framework.Bindables;
using osu.Framework.Extensions.LocalisationExtensions;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Framework.Input.Events; using osu.Framework.Input.Events;
@ -81,7 +82,7 @@ namespace osu.Game.Overlays.Login
{ {
new OsuSpriteText new OsuSpriteText
{ {
Text = "ACCOUNT", Text = LoginPanelStrings.Account.ToUpper(),
Margin = new MarginPadding { Bottom = 5 }, Margin = new MarginPadding { Bottom = 5 },
Font = OsuFont.GetFont(weight: FontWeight.Bold), Font = OsuFont.GetFont(weight: FontWeight.Bold),
}, },
@ -115,7 +116,7 @@ namespace osu.Game.Overlays.Login
}, },
}; };
linkFlow.AddLink("cancel", api.Logout, string.Empty); linkFlow.AddLink(Resources.Localisation.Web.CommonStrings.ButtonsCancel.ToLower(), api.Logout, string.Empty);
break; break;
case APIState.Online: case APIState.Online:
@ -140,7 +141,7 @@ namespace osu.Game.Overlays.Login
{ {
Anchor = Anchor.Centre, Anchor = Anchor.Centre,
Origin = Anchor.Centre, Origin = Anchor.Centre,
Text = "Signed in", Text = LoginPanelStrings.SignedIn,
Font = OsuFont.GetFont(size: 18, weight: FontWeight.Bold), Font = OsuFont.GetFont(size: 18, weight: FontWeight.Bold),
Margin = new MarginPadding { Top = 5, Bottom = 5 }, Margin = new MarginPadding { Top = 5, Bottom = 5 },
}, },

View File

@ -1,11 +1,9 @@
// 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.
#nullable disable
using System.ComponentModel;
using osu.Framework.Localisation; using osu.Framework.Localisation;
using osu.Game.Resources.Localisation.Web; using osu.Game.Resources.Localisation.Web;
using osu.Game.Localisation;
namespace osu.Game.Overlays.Login namespace osu.Game.Overlays.Login
{ {
@ -14,13 +12,13 @@ namespace osu.Game.Overlays.Login
[LocalisableDescription(typeof(UsersStrings), nameof(UsersStrings.StatusOnline))] [LocalisableDescription(typeof(UsersStrings), nameof(UsersStrings.StatusOnline))]
Online, Online,
[Description(@"Do not disturb")] [LocalisableDescription(typeof(LoginPanelStrings), nameof(LoginPanelStrings.DoNotDisturb))]
DoNotDisturb, DoNotDisturb,
[Description(@"Appear offline")] [LocalisableDescription(typeof(LoginPanelStrings), nameof(LoginPanelStrings.AppearOffline))]
AppearOffline, AppearOffline,
[Description(@"Sign out")] [LocalisableDescription(typeof(UserVerificationStrings), nameof(UserVerificationStrings.BoxInfoLogoutLink))]
SignOut, SignOut,
} }
} }