From 8322e4930588c36e9d4dc0a8167dc74d128d00d7 Mon Sep 17 00:00:00 2001 From: Kyle Spearrin Date: Fri, 25 Nov 2016 16:54:33 -0500 Subject: [PATCH] i18n resource strings for pre-login pages --- src/App/Pages/HomePage.cs | 8 +- src/App/Pages/LoginPage.cs | 8 +- src/App/Pages/LoginTwoFactorPage.cs | 12 +- src/App/Pages/PasswordHintPage.cs | 10 +- src/App/Pages/RegisterPage.cs | 24 +-- src/App/Resources/AppResources.Designer.cs | 180 +++++++++++++++++++++ src/App/Resources/AppResources.resx | 64 ++++++++ 7 files changed, 275 insertions(+), 31 deletions(-) diff --git a/src/App/Pages/HomePage.cs b/src/App/Pages/HomePage.cs index a60427af7..ee5306a96 100644 --- a/src/App/Pages/HomePage.cs +++ b/src/App/Pages/HomePage.cs @@ -39,7 +39,7 @@ namespace Bit.App.Pages var message = new Label { - Text = "Log in or create a new account to access your secure vault.", + Text = AppResources.LoginOrCreateNewAccount, VerticalOptions = LayoutOptions.StartAndExpand, HorizontalOptions = LayoutOptions.Center, HorizontalTextAlignment = TextAlignment.Center, @@ -50,7 +50,7 @@ namespace Bit.App.Pages var createAccountButton = new ExtendedButton { - Text = "Create Account", + Text = AppResources.CreateAccount, Command = new Command(async () => await RegisterAsync()), VerticalOptions = LayoutOptions.End, HorizontalOptions = LayoutOptions.Fill, @@ -76,7 +76,7 @@ namespace Bit.App.Pages Children = { logo, message, createAccountButton, loginButton } }; - Title = "bitwarden"; + Title = AppResources.Bitwarden; NavigationPage.SetHasNavigationBar(this, false); Content = new ScrollView { Content = buttonStackLayout }; } @@ -101,7 +101,7 @@ namespace Bit.App.Pages { await Navigation.PopForDeviceAsync(); await Navigation.PushForDeviceAsync(new LoginPage(email)); - _userDialogs.Toast("Your new account has been created! You may now log in."); + _userDialogs.Toast(AppResources.AccountCreated); } } } diff --git a/src/App/Pages/LoginPage.cs b/src/App/Pages/LoginPage.cs index 7c99d85a2..918150b0a 100644 --- a/src/App/Pages/LoginPage.cs +++ b/src/App/Pages/LoginPage.cs @@ -94,7 +94,7 @@ namespace Bit.App.Pages var forgotPasswordButton = new ExtendedButton { - Text = "Get your master password hint", + Text = AppResources.GetPasswordHint, Style = (Style)Application.Current.Resources["btn-primaryAccent"], Margin = new Thickness(15, 0, 15, 25), Command = new Command(async () => await ForgotPasswordAsync()), @@ -114,7 +114,7 @@ namespace Bit.App.Pages { table.RowHeight = -1; table.EstimatedRowHeight = 70; - ToolbarItems.Add(new DismissModalToolBarItem(this, "Cancel", () => + ToolbarItems.Add(new DismissModalToolBarItem(this, AppResources.Cancel, () => { MessagingCenter.Send(Application.Current, "ShowStatusBar", false); })); @@ -128,7 +128,7 @@ namespace Bit.App.Pages ToolbarItems.Add(loginToolbarItem); Title = AppResources.Bitwarden; Content = scrollView; - NavigationPage.SetBackButtonTitle(this, "Log In"); + NavigationPage.SetBackButtonTitle(this, AppResources.LogIn); } protected override void OnAppearing() @@ -186,7 +186,7 @@ namespace Bit.App.Pages Device = new DeviceRequest(_appIdService, _deviceInfoService) }; - _userDialogs.ShowLoading("Logging in...", MaskType.Black); + _userDialogs.ShowLoading(AppResources.LoggingIn, MaskType.Black); var response = await _authService.TokenPostAsync(request); _userDialogs.HideLoading(); if(!response.Succeeded) diff --git a/src/App/Pages/LoginTwoFactorPage.cs b/src/App/Pages/LoginTwoFactorPage.cs index 9939cff6e..ad40a9c2b 100644 --- a/src/App/Pages/LoginTwoFactorPage.cs +++ b/src/App/Pages/LoginTwoFactorPage.cs @@ -42,7 +42,7 @@ namespace Bit.App.Pages Android: new Thickness(15, 8), WinPhone: new Thickness(15, 20)); - CodeCell = new FormEntryCell("Verification Code", useLabelAsPlaceholder: true, + CodeCell = new FormEntryCell(AppResources.VerificationCode, useLabelAsPlaceholder: true, imageSource: "lock", containerPadding: padding); CodeCell.Entry.Keyboard = Keyboard.Numeric; @@ -68,7 +68,7 @@ namespace Bit.App.Pages var codeLabel = new Label { - Text = "Enter your two-step verification code.", + Text = AppResources.EnterVerificationCode, LineBreakMode = LineBreakMode.WordWrap, FontSize = Device.GetNamedSize(NamedSize.Small, typeof(Label)), Style = (Style)Application.Current.Resources["text-muted"], @@ -89,13 +89,13 @@ namespace Bit.App.Pages table.EstimatedRowHeight = 70; } - var continueToolbarItem = new ToolbarItem("Continue", null, async () => + var continueToolbarItem = new ToolbarItem(AppResources.Continue, null, async () => { await LogIn(); }, ToolbarItemOrder.Default, 0); ToolbarItems.Add(continueToolbarItem); - Title = "Verification Code"; + Title = AppResources.VerificationCode; Content = scrollView; } @@ -115,7 +115,7 @@ namespace Bit.App.Pages if(string.IsNullOrWhiteSpace(CodeCell.Entry.Text)) { await DisplayAlert(AppResources.AnErrorHasOccurred, string.Format(AppResources.ValidationFieldRequired, - "Verification code"), AppResources.Ok); + AppResources.VerificationCode), AppResources.Ok); return; } @@ -126,7 +126,7 @@ namespace Bit.App.Pages Device = new DeviceRequest(_appIdService, _deviceInfoService) }; - _userDialogs.ShowLoading("Validating code...", MaskType.Black); + _userDialogs.ShowLoading(AppResources.ValidatingCode, MaskType.Black); var response = await _authService.TokenTwoFactorPostAsync(request); _userDialogs.HideLoading(); if(!response.Succeeded) diff --git a/src/App/Pages/PasswordHintPage.cs b/src/App/Pages/PasswordHintPage.cs index 867b5733a..02cce73fc 100644 --- a/src/App/Pages/PasswordHintPage.cs +++ b/src/App/Pages/PasswordHintPage.cs @@ -59,7 +59,7 @@ namespace Bit.App.Pages var hintLabel = new Label { - Text = "Enter your account email address to receive your master password hint.", + Text = AppResources.EnterEmailForHint, LineBreakMode = LineBreakMode.WordWrap, FontSize = Device.GetNamedSize(NamedSize.Small, typeof(Label)), Style = (Style)Application.Current.Resources["text-muted"], @@ -80,13 +80,13 @@ namespace Bit.App.Pages table.EstimatedRowHeight = 70; } - var submitToolbarItem = new ToolbarItem("Submit", null, async () => + var submitToolbarItem = new ToolbarItem(AppResources.Submit, null, async () => { await SubmitAsync(); }, ToolbarItemOrder.Default, 0); ToolbarItems.Add(submitToolbarItem); - Title = "Password Hint"; + Title = AppResources.PasswordHint; Content = scrollView; } @@ -115,7 +115,7 @@ namespace Bit.App.Pages Email = EmailCell.Entry.Text }; - _userDialogs.ShowLoading("Submitting...", MaskType.Black); + _userDialogs.ShowLoading(AppResources.Submitting, MaskType.Black); var response = await _accountApiRepository.PostPasswordHintAsync(request); _userDialogs.HideLoading(); if(!response.Succeeded) @@ -125,7 +125,7 @@ namespace Bit.App.Pages } else { - await DisplayAlert(null, "We've sent you an email with your master password hint. ", AppResources.Ok); + await DisplayAlert(null, AppResources.PasswordHintAlert, AppResources.Ok); } await Navigation.PopAsync(); diff --git a/src/App/Pages/RegisterPage.cs b/src/App/Pages/RegisterPage.cs index 2e779d83d..d5fb9076d 100644 --- a/src/App/Pages/RegisterPage.cs +++ b/src/App/Pages/RegisterPage.cs @@ -45,9 +45,9 @@ namespace Bit.App.Pages Android: new Thickness(15, 8), WinPhone: new Thickness(15, 20)); - PasswordHintCell = new FormEntryCell("Master Password Hint (optional)", useLabelAsPlaceholder: true, + PasswordHintCell = new FormEntryCell(AppResources.MasterPasswordHint, useLabelAsPlaceholder: true, imageSource: "lightbulb", containerPadding: padding); - ConfirmPasswordCell = new FormEntryCell("Re-type Master Password", isPassword: true, + ConfirmPasswordCell = new FormEntryCell(AppResources.RetypeMasterPassword, isPassword: true, nextElement: PasswordHintCell.Entry, useLabelAsPlaceholder: true, imageSource: "lock", containerPadding: padding); PasswordCell = new FormEntryCell(AppResources.MasterPassword, isPassword: true, @@ -74,8 +74,7 @@ namespace Bit.App.Pages var passwordLabel = new Label { - Text = "The master password is the password you use to access your vault. It is very important that you do not" - + " forget your master password. There is no way to recover the password in the event that you forget it.", + Text = AppResources.MasterPasswordDescription, LineBreakMode = LineBreakMode.WordWrap, FontSize = Device.GetNamedSize(NamedSize.Small, typeof(Label)), Style = (Style)Application.Current.Resources["text-muted"], @@ -97,7 +96,7 @@ namespace Bit.App.Pages var hintLabel = new Label { - Text = "A master password hint can help you remember your password if you forget it.", + Text = AppResources.MasterPasswordHintDescription, LineBreakMode = LineBreakMode.WordWrap, FontSize = Device.GetNamedSize(NamedSize.Small, typeof(Label)), Style = (Style)Application.Current.Resources["text-muted"], @@ -121,7 +120,7 @@ namespace Bit.App.Pages Content = layout }; - var loginToolbarItem = new ToolbarItem("Submit", null, async () => + var loginToolbarItem = new ToolbarItem(AppResources.Submit, null, async () => { await Register(); }, ToolbarItemOrder.Default, 0); @@ -130,14 +129,14 @@ namespace Bit.App.Pages { table.RowHeight = table2.RowHeight = table2.RowHeight = -1; table.EstimatedRowHeight = table2.EstimatedRowHeight = table2.EstimatedRowHeight = 70; - ToolbarItems.Add(new DismissModalToolBarItem(this, "Cancel", () => + ToolbarItems.Add(new DismissModalToolBarItem(this, AppResources.Cancel, () => { MessagingCenter.Send(Application.Current, "ShowStatusBar", false); })); } ToolbarItems.Add(loginToolbarItem); - Title = "Create Account"; + Title = AppResources.CreateAccount; Content = scrollView; } @@ -171,14 +170,15 @@ namespace Bit.App.Pages if(PasswordCell.Entry.Text.Length < 8) { - await DisplayAlert(AppResources.AnErrorHasOccurred, - "Master password must be at least 8 characters long.", AppResources.Ok); + await DisplayAlert(AppResources.AnErrorHasOccurred, AppResources.MasterPasswordLengthValMessage, + AppResources.Ok); return; } if(ConfirmPasswordCell.Entry.Text != PasswordCell.Entry.Text) { - await DisplayAlert(AppResources.AnErrorHasOccurred, "Password confirmation is not correct.", AppResources.Ok); + await DisplayAlert(AppResources.AnErrorHasOccurred, AppResources.MasterPasswordLengthValMessage, + AppResources.Ok); return; } @@ -192,7 +192,7 @@ namespace Bit.App.Pages ? PasswordHintCell.Entry.Text : null }; - _userDialogs.ShowLoading("Creating account...", MaskType.Black); + _userDialogs.ShowLoading(AppResources.CreatingAccount, MaskType.Black); var response = await _accountsApiRepository.PostRegisterAsync(request); _userDialogs.HideLoading(); if(!response.Succeeded) diff --git a/src/App/Resources/AppResources.Designer.cs b/src/App/Resources/AppResources.Designer.cs index 6a4ad3e45..5ba3badb8 100644 --- a/src/App/Resources/AppResources.Designer.cs +++ b/src/App/Resources/AppResources.Designer.cs @@ -79,6 +79,15 @@ namespace Bit.App.Resources { } } + /// + /// Looks up a localized string similar to Your new account has been created! You may now log in.. + /// + public static string AccountCreated { + get { + return ResourceManager.GetString("AccountCreated", resourceCulture); + } + } + /// /// Looks up a localized string similar to Add. /// @@ -286,6 +295,15 @@ namespace Bit.App.Resources { } } + /// + /// Looks up a localized string similar to Continue. + /// + public static string Continue { + get { + return ResourceManager.GetString("Continue", resourceCulture); + } + } + /// /// Looks up a localized string similar to Copy. /// @@ -313,6 +331,24 @@ namespace Bit.App.Resources { } } + /// + /// Looks up a localized string similar to Create Account. + /// + public static string CreateAccount { + get { + return ResourceManager.GetString("CreateAccount", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Creating account.... + /// + public static string CreatingAccount { + get { + return ResourceManager.GetString("CreatingAccount", resourceCulture); + } + } + /// /// Looks up a localized string similar to Credits. /// @@ -430,6 +466,15 @@ namespace Bit.App.Resources { } } + /// + /// Looks up a localized string similar to Enter your account email address to receive your master password hint.. + /// + public static string EnterEmailForHint { + get { + return ResourceManager.GetString("EnterEmailForHint", resourceCulture); + } + } + /// /// Looks up a localized string similar to Enter your PIN code.. /// @@ -439,6 +484,15 @@ namespace Bit.App.Resources { } } + /// + /// Looks up a localized string similar to Enter your two-step verification code.. + /// + public static string EnterVerificationCode { + get { + return ResourceManager.GetString("EnterVerificationCode", resourceCulture); + } + } + /// /// Looks up a localized string similar to Re-enable App Extension. /// @@ -637,6 +691,15 @@ namespace Bit.App.Resources { } } + /// + /// Looks up a localized string similar to Get your master password hint. + /// + public static string GetPasswordHint { + get { + return ResourceManager.GetString("GetPasswordHint", resourceCulture); + } + } + /// /// Looks up a localized string similar to Go To Website. /// @@ -817,6 +880,15 @@ namespace Bit.App.Resources { } } + /// + /// Looks up a localized string similar to Logging in.... + /// + public static string LoggingIn { + get { + return ResourceManager.GetString("LoggingIn", resourceCulture); + } + } + /// /// Looks up a localized string similar to Log In. /// @@ -835,6 +907,15 @@ namespace Bit.App.Resources { } } + /// + /// Looks up a localized string similar to Log in or create a new account to access your secure vault.. + /// + public static string LoginOrCreateNewAccount { + get { + return ResourceManager.GetString("LoginOrCreateNewAccount", resourceCulture); + } + } + /// /// Looks up a localized string similar to Log Out. /// @@ -871,6 +952,51 @@ namespace Bit.App.Resources { } } + /// + /// Looks up a localized string similar to Password confirmation is not correct.. + /// + public static string MasterPasswordConfirmationValMessage { + get { + return ResourceManager.GetString("MasterPasswordConfirmationValMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The master password is the password you use to access your vault. It is very important that you do not forget your master password. There is no way to recover the password in the event that you forget it.. + /// + public static string MasterPasswordDescription { + get { + return ResourceManager.GetString("MasterPasswordDescription", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Master Password Hint (optional). + /// + public static string MasterPasswordHint { + get { + return ResourceManager.GetString("MasterPasswordHint", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to A master password hint can help you remember your password if you forget it.. + /// + public static string MasterPasswordHintDescription { + get { + return ResourceManager.GetString("MasterPasswordHintDescription", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Master password must be at least 8 characters long.. + /// + public static string MasterPasswordLengthValMessage { + get { + return ResourceManager.GetString("MasterPasswordLengthValMessage", resourceCulture); + } + } + /// /// Looks up a localized string similar to Minimum Numbers. /// @@ -1051,6 +1177,24 @@ namespace Bit.App.Resources { } } + /// + /// Looks up a localized string similar to Password Hint. + /// + public static string PasswordHint { + get { + return ResourceManager.GetString("PasswordHint", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to We've sent you an email with your master password hint.. + /// + public static string PasswordHintAlert { + get { + return ResourceManager.GetString("PasswordHintAlert", resourceCulture); + } + } + /// /// Looks up a localized string similar to Are you sure you want to overwrite the current password?. /// @@ -1105,6 +1249,15 @@ namespace Bit.App.Resources { } } + /// + /// Looks up a localized string similar to Re-type Master Password. + /// + public static string RetypeMasterPassword { + get { + return ResourceManager.GetString("RetypeMasterPassword", resourceCulture); + } + } + /// /// Looks up a localized string similar to Save. /// @@ -1240,6 +1393,15 @@ namespace Bit.App.Resources { } } + /// + /// Looks up a localized string similar to Submitting.... + /// + public static string Submitting { + get { + return ResourceManager.GetString("Submitting", resourceCulture); + } + } + /// /// Looks up a localized string similar to Sync. /// @@ -1375,6 +1537,15 @@ namespace Bit.App.Resources { } } + /// + /// Looks up a localized string similar to Validating code.... + /// + public static string ValidatingCode { + get { + return ResourceManager.GetString("ValidatingCode", resourceCulture); + } + } + /// /// Looks up a localized string similar to The {0} field is required.. /// @@ -1393,6 +1564,15 @@ namespace Bit.App.Resources { } } + /// + /// Looks up a localized string similar to Verification Code. + /// + public static string VerificationCode { + get { + return ResourceManager.GetString("VerificationCode", resourceCulture); + } + } + /// /// Looks up a localized string similar to Verify Fingerprint. /// diff --git a/src/App/Resources/AppResources.resx b/src/App/Resources/AppResources.resx index ee7c6f9a1..8e0c5ef27 100644 --- a/src/App/Resources/AppResources.resx +++ b/src/App/Resources/AppResources.resx @@ -394,6 +394,9 @@ Account + + Your new account has been created! You may now log in. + Add a Site @@ -442,6 +445,16 @@ Coming Soon! + + Continue + + + Create Account + + + Creating account... + Message shown when interacting with the server + Current Session @@ -451,6 +464,12 @@ Enable Automatic Syncing + + Enter your account email address to receive your master password hint. + + + Enter your two-step verification code. + Re-enable App Extension @@ -488,6 +507,9 @@ Generate Password + + Get your master password hint + Import Logins @@ -524,9 +546,31 @@ Lock Options + + Logging in... + Message shown when interacting with the server + + + Log in or create a new account to access your secure vault. + Manage + + Password confirmation is not correct. + + + The master password is the password you use to access your vault. It is very important that you do not forget your master password. There is no way to recover the password in the event that you forget it. + + + Master Password Hint (optional) + + + A master password hint can help you remember your password if you forget it. + + + Master password must be at least 8 characters long. + Minimum Numbers Minimum numeric characters for password generator settings @@ -569,6 +613,12 @@ Automatically generate strong, unique passwords for your logins. + + Password Hint + + + We've sent you an email with your master password hint. + Are you sure you want to overwrite the current password? @@ -588,6 +638,9 @@ Regenerate Password + + Re-type Master Password + Search vault @@ -612,6 +665,10 @@ Site updated. + + Submitting... + Message shown when interacting with the server + Syncing... Message shown when interacting with the server @@ -641,6 +698,13 @@ Unlock with PIN Code + + Validating code... + Message shown when interacting with the server + + + Verification Code + View Site