mirror of
https://github.com/ppy/osu.git
synced 2025-02-14 16:02:55 +08:00
Localise login form
This commit is contained in:
parent
4224907f08
commit
ff5a12fcb4
54
osu.Game/Localisation/LoginPanelStrings.cs
Normal file
54
osu.Game/Localisation/LoginPanelStrings.cs
Normal 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 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>
|
||||
/// "Sign out"
|
||||
/// </summary>
|
||||
public static LocalisableString SignOut => new TranslatableString(getKey(@"sign_out"), @"Sign out");
|
||||
|
||||
/// <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}";
|
||||
}
|
||||
}
|
@ -16,6 +16,7 @@ using osu.Game.Online.API;
|
||||
using osu.Game.Overlays.Settings;
|
||||
using osu.Game.Resources.Localisation.Web;
|
||||
using osuTK;
|
||||
using osu.Game.Localisation;
|
||||
|
||||
namespace osu.Game.Overlays.Login
|
||||
{
|
||||
@ -47,7 +48,7 @@ namespace osu.Game.Overlays.Login
|
||||
RelativeSizeAxes = Axes.X;
|
||||
|
||||
ErrorTextFlowContainer errorText;
|
||||
LinkFlowContainer forgottenPaswordLink;
|
||||
LinkFlowContainer forgottenPasswordLink;
|
||||
|
||||
Children = new Drawable[]
|
||||
{
|
||||
@ -71,15 +72,15 @@ namespace osu.Game.Overlays.Login
|
||||
},
|
||||
new SettingsCheckbox
|
||||
{
|
||||
LabelText = "Remember username",
|
||||
LabelText = LoginPanelStrings.RememberUsername,
|
||||
Current = config.GetBindable<bool>(OsuSetting.SaveUsername),
|
||||
},
|
||||
new SettingsCheckbox
|
||||
{
|
||||
LabelText = "Stay signed in",
|
||||
LabelText = LoginPanelStrings.StaySignedIn,
|
||||
Current = config.GetBindable<bool>(OsuSetting.SavePassword),
|
||||
},
|
||||
forgottenPaswordLink = new LinkFlowContainer
|
||||
forgottenPasswordLink = new LinkFlowContainer
|
||||
{
|
||||
Padding = new MarginPadding { Left = SettingsPanel.CONTENT_MARGINS },
|
||||
RelativeSizeAxes = Axes.X,
|
||||
@ -105,7 +106,7 @@ namespace osu.Game.Overlays.Login
|
||||
},
|
||||
new SettingsButton
|
||||
{
|
||||
Text = "Register",
|
||||
Text = LoginPanelStrings.Register,
|
||||
Action = () =>
|
||||
{
|
||||
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();
|
||||
|
||||
|
@ -6,6 +6,7 @@
|
||||
using System;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Extensions.LocalisationExtensions;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Input.Events;
|
||||
@ -81,7 +82,7 @@ namespace osu.Game.Overlays.Login
|
||||
{
|
||||
new OsuSpriteText
|
||||
{
|
||||
Text = "ACCOUNT",
|
||||
Text = LoginPanelStrings.Account,
|
||||
Margin = new MarginPadding { Bottom = 5 },
|
||||
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;
|
||||
|
||||
case APIState.Online:
|
||||
@ -140,7 +141,7 @@ namespace osu.Game.Overlays.Login
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
Text = "Signed in",
|
||||
Text = LoginPanelStrings.SignedIn,
|
||||
Font = OsuFont.GetFont(size: 18, weight: FontWeight.Bold),
|
||||
Margin = new MarginPadding { Top = 5, Bottom = 5 },
|
||||
},
|
||||
|
@ -1,11 +1,9 @@
|
||||
// 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.
|
||||
|
||||
#nullable disable
|
||||
|
||||
using System.ComponentModel;
|
||||
using osu.Framework.Localisation;
|
||||
using osu.Game.Resources.Localisation.Web;
|
||||
using osu.Game.Localisation;
|
||||
|
||||
namespace osu.Game.Overlays.Login
|
||||
{
|
||||
@ -14,13 +12,13 @@ namespace osu.Game.Overlays.Login
|
||||
[LocalisableDescription(typeof(UsersStrings), nameof(UsersStrings.StatusOnline))]
|
||||
Online,
|
||||
|
||||
[Description(@"Do not disturb")]
|
||||
[LocalisableDescription(typeof(LoginPanelStrings), nameof(LoginPanelStrings.DoNotDisturb))]
|
||||
DoNotDisturb,
|
||||
|
||||
[Description(@"Appear offline")]
|
||||
[LocalisableDescription(typeof(LoginPanelStrings), nameof(LoginPanelStrings.AppearOffline))]
|
||||
AppearOffline,
|
||||
|
||||
[Description(@"Sign out")]
|
||||
[LocalisableDescription(typeof(LoginPanelStrings), nameof(LoginPanelStrings.SignOut))]
|
||||
SignOut,
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user