From f4c4962cb8358d3eed2108a281dffafa8b72c5be Mon Sep 17 00:00:00 2001 From: Leendert de Borst Date: Mon, 14 Jul 2025 18:07:30 +0200 Subject: [PATCH] Localize Enable2Fa page (#1006) --- .../Pages/Settings/Security/Enable2Fa.razor | 24 ++-- .../Pages/Settings/Security/Enable2Fa.en.resx | 107 ++++++++++++++++++ 2 files changed, 120 insertions(+), 11 deletions(-) create mode 100644 apps/server/AliasVault.Client/Resources/Components/Main/Pages/Settings/Security/Enable2Fa.en.resx diff --git a/apps/server/AliasVault.Client/Main/Pages/Settings/Security/Enable2Fa.razor b/apps/server/AliasVault.Client/Main/Pages/Settings/Security/Enable2Fa.razor index a66b241f7..b15e5dc9f 100644 --- a/apps/server/AliasVault.Client/Main/Pages/Settings/Security/Enable2Fa.razor +++ b/apps/server/AliasVault.Client/Main/Pages/Settings/Security/Enable2Fa.razor @@ -1,15 +1,16 @@ @page "/settings/security/enable-2fa" @using AliasVault.Client.Main.Pages.Settings.Security.Components +@using Microsoft.Extensions.Localization @inherits MainBase @inject HttpClient Http -Enable two-factor authentication +@Localizer["PageTitle"]
-

Enable two-factor authentication

-

Enable two-factor authentication to increase the security of your vaults.

+

@Localizer["PageTitle"]

+

@Localizer["PageDescription"]

@@ -30,7 +31,7 @@ else

- Scan this QR code with your authenticator app or enter the following secret manually: + @Localizer["QrCodeInstructions"]

@Secret
@@ -38,11 +39,11 @@ else
+ placeholder="@Localizer["VerificationCodePlaceholder"]"/>
@@ -56,13 +57,15 @@ else private List? RecoveryCodes { get; set; } private readonly VerificationModel VerifyModel = new(); + private IStringLocalizer Localizer => LocalizerFactory.Create("Components.Main.Pages.Settings.Security.Enable2Fa", "AliasVault.Client"); + /// protected override async Task OnInitializedAsync() { await base.OnInitializedAsync(); - BreadcrumbItems.Add(new BreadcrumbItem { DisplayName = "Security settings", Url = "/settings/security" }); - BreadcrumbItems.Add(new BreadcrumbItem { DisplayName = "Enable two-factor authentication" }); + BreadcrumbItems.Add(new BreadcrumbItem { DisplayName = Localizer["BreadcrumbSecuritySettings"], Url = "/settings/security" }); + BreadcrumbItems.Add(new BreadcrumbItem { DisplayName = Localizer["BreadcrumbEnable2Fa"] }); } /// @@ -107,8 +110,7 @@ else if (result != null) { - GlobalNotificationService.AddSuccessMessage("Two-factor authentication is now successfully enabled. On your " + - "next login you will need to enter your 2FA code.", true); + GlobalNotificationService.AddSuccessMessage(Localizer["TwoFactorEnabledSuccess"], true); // Show recovery codes. RecoveryCodes = result.RecoveryCodes; @@ -118,7 +120,7 @@ else } } - GlobalNotificationService.AddErrorMessage("Failed to enable two-factor authentication.", true); + GlobalNotificationService.AddErrorMessage(Localizer["FailedToEnable2Fa"], true); StateHasChanged(); } diff --git a/apps/server/AliasVault.Client/Resources/Components/Main/Pages/Settings/Security/Enable2Fa.en.resx b/apps/server/AliasVault.Client/Resources/Components/Main/Pages/Settings/Security/Enable2Fa.en.resx new file mode 100644 index 000000000..9498a7b34 --- /dev/null +++ b/apps/server/AliasVault.Client/Resources/Components/Main/Pages/Settings/Security/Enable2Fa.en.resx @@ -0,0 +1,107 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + + + Enable two-factor authentication + Page title for the enable 2FA page + + + Security settings + Breadcrumb text for security settings + + + Enable two-factor authentication + Breadcrumb text for enable 2FA + + + + + Enable two-factor authentication to increase the security of your vaults. + Description text explaining 2FA setup + + + + + Scan this QR code with your authenticator app or enter the following secret manually: + Instructions for scanning QR code or entering secret + + + + + Enter verification code + Placeholder text for verification code input + + + Verify and Enable + Button text to verify and enable 2FA + + + + + Two-factor authentication is now successfully enabled. On your next login you will need to enter your 2FA code. + Success message when 2FA is enabled + + + Failed to enable two-factor authentication. + Error message when 2FA setup fails + + \ No newline at end of file