1
0
mirror of https://github.com/bitwarden/mobile synced 2026-01-04 09:33:16 +00:00

i18n resource strings for lock and settings pages

This commit is contained in:
Kyle Spearrin
2016-11-25 13:22:11 -05:00
parent c0a532a0fe
commit 071ec61683
14 changed files with 838 additions and 89 deletions

View File

@@ -41,7 +41,7 @@ namespace Bit.App.Pages
var fingerprintButton = new ExtendedButton
{
Text = "Use Fingerprint to Unlock",
Text = AppResources.UseFingerprintToUnlock,
Command = new Command(async () => await CheckFingerprintAsync()),
VerticalOptions = LayoutOptions.EndAndExpand,
Style = (Style)Application.Current.Resources["btn-primary"]
@@ -64,7 +64,7 @@ namespace Bit.App.Pages
Children = { fingerprintIcon, fingerprintButton, logoutButton }
};
Title = "Verify Fingerprint";
Title = AppResources.VerifyFingerprint;
Content = stackLayout;
}
@@ -85,7 +85,7 @@ namespace Bit.App.Pages
public async Task LogoutAsync()
{
if(!await _userDialogs.ConfirmAsync("Are you sure you want to log out?", null, AppResources.Yes, AppResources.Cancel))
if(!await _userDialogs.ConfirmAsync(AppResources.LogoutConfirmation, null, AppResources.Yes, AppResources.Cancel))
{
return;
}
@@ -95,7 +95,7 @@ namespace Bit.App.Pages
public async Task CheckFingerprintAsync()
{
var result = await _fingerprint.AuthenticateAsync("Use your fingerprint to verify.");
var result = await _fingerprint.AuthenticateAsync(AppResources.FingerprintDirection);
if(result.Authenticated)
{
_settings.AddOrUpdateValue(Constants.Locked, false);

View File

@@ -85,13 +85,13 @@ namespace Bit.App.Pages
table.EstimatedRowHeight = 70;
}
var loginToolbarItem = new ToolbarItem("Submit", null, async () =>
var loginToolbarItem = new ToolbarItem(AppResources.Submit, null, async () =>
{
await CheckPasswordAsync();
}, ToolbarItemOrder.Default, 0);
ToolbarItems.Add(loginToolbarItem);
Title = "Verify Master Password";
Title = AppResources.VerifyMasterPassword;
Content = scrollView;
}
@@ -129,7 +129,7 @@ namespace Bit.App.Pages
{
// TODO: keep track of invalid attempts and logout?
_userDialogs.Alert("Invalid Master Password. Try again.");
_userDialogs.Alert(AppResources.InvalidMasterPassword);
PasswordCell.Entry.Text = string.Empty;
PasswordCell.Entry.Focus();
}
@@ -137,7 +137,7 @@ namespace Bit.App.Pages
private async Task LogoutAsync()
{
if(!await _userDialogs.ConfirmAsync("Are you sure you want to log out?", null, AppResources.Yes, AppResources.Cancel))
if(!await _userDialogs.ConfirmAsync(AppResources.LogoutConfirmation, null, AppResources.Yes, AppResources.Cancel))
{
return;
}

View File

@@ -34,7 +34,7 @@ namespace Bit.App.Pages
{
var instructionLabel = new Label
{
Text = "Enter your PIN code.",
Text = AppResources.EnterPIN,
LineBreakMode = LineBreakMode.WordWrap,
FontSize = Device.GetNamedSize(NamedSize.Small, typeof(Label)),
HorizontalTextAlignment = TextAlignment.Center,
@@ -68,7 +68,7 @@ namespace Bit.App.Pages
PinControl.Label.GestureRecognizers.Add(tgr);
instructionLabel.GestureRecognizers.Add(tgr);
Title = "Verify PIN";
Title = AppResources.VerifyPIN;
Content = stackLayout;
Content.GestureRecognizers.Add(tgr);
BindingContext = Model;
@@ -102,7 +102,7 @@ namespace Bit.App.Pages
{
// TODO: keep track of invalid attempts and logout?
_userDialogs.Alert("Invalid PIN. Try again.");
_userDialogs.Alert(AppResources.InvalidPIN);
Model.PIN = string.Empty;
PinControl.Entry.Focus();
}
@@ -110,7 +110,7 @@ namespace Bit.App.Pages
private async Task LogoutAsync()
{
if(!await _userDialogs.ConfirmAsync("Are you sure you want to log out?", null, AppResources.Yes, AppResources.Cancel))
if(!await _userDialogs.ConfirmAsync(AppResources.LogoutConfirmation, null, AppResources.Yes, AppResources.Cancel))
{
return;
}

View File

@@ -3,6 +3,7 @@ using Bit.App.Controls;
using Xamarin.Forms;
using Bit.App.Abstractions;
using XLabs.Ioc;
using Bit.App.Resources;
namespace Bit.App.Pages
{
@@ -27,7 +28,7 @@ namespace Bit.App.Pages
var versionLabel = new Label
{
FontSize = Device.GetNamedSize(NamedSize.Medium, typeof(Label)),
Text = $@"Version {_appInfoService.Version} ({_appInfoService.Build})
Text = $@"{AppResources.Version} {_appInfoService.Version} ({_appInfoService.Build})
© 8bit Solutions LLC 2015-{DateTime.Now.Year}",
HorizontalTextAlignment = TextAlignment.Center
};
@@ -41,7 +42,7 @@ namespace Bit.App.Pages
var creditsCell = new ExtendedTextCell
{
Text = "Credits",
Text = AppResources.Credits,
ShowDisclousure = true
};
creditsCell.Tapped += RateCell_Tapped;
@@ -73,7 +74,7 @@ namespace Bit.App.Pages
Spacing = 0
};
Title = "About";
Title = AppResources.About;
Content = new ScrollView { Content = stackLayout };
}

View File

@@ -72,7 +72,7 @@ namespace Bit.App.Pages
Name = nameCell.Entry.Text.Encrypt()
};
_userDialogs.ShowLoading("Saving...", MaskType.Black);
_userDialogs.ShowLoading(AppResources.Saving, MaskType.Black);
var saveResult = await _folderService.SaveAsync(folder);
_userDialogs.HideLoading();
@@ -80,7 +80,7 @@ namespace Bit.App.Pages
if(saveResult.Succeeded)
{
await Navigation.PopForDeviceAsync();
_userDialogs.Toast("New folder created.");
_userDialogs.Toast(AppResources.FolderCreated);
_googleAnalyticsService.TrackAppEvent("CreatedFolder");
}
else if(saveResult.Errors.Count() > 0)
@@ -93,12 +93,12 @@ namespace Bit.App.Pages
}
}, ToolbarItemOrder.Default, 0);
Title = "Add Folder";
Title = AppResources.AddFolder;
Content = table;
ToolbarItems.Add(saveToolBarItem);
if(Device.OS == TargetPlatform.iOS)
{
ToolbarItems.Add(new DismissModalToolBarItem(this, "Cancel"));
ToolbarItems.Add(new DismissModalToolBarItem(this, AppResources.Cancel));
}
}

View File

@@ -1,6 +1,7 @@
using System;
using Bit.App.Controls;
using Xamarin.Forms;
using Bit.App.Resources;
namespace Bit.App.Pages
{
@@ -35,7 +36,7 @@ Fingerprint by masterpage.com from the Noun Project")
table.EstimatedRowHeight = 100;
}
Title = "Thank You";
Title = AppResources.ThankYou;
Content = table;
}

View File

@@ -86,7 +86,7 @@ namespace Bit.App.Pages
folder.Name = nameCell.Entry.Text.Encrypt();
_userDialogs.ShowLoading("Saving...", MaskType.Black);
_userDialogs.ShowLoading(AppResources.Saving, MaskType.Black);
var saveResult = await _folderService.SaveAsync(folder);
_userDialogs.HideLoading();
@@ -94,7 +94,7 @@ namespace Bit.App.Pages
if(saveResult.Succeeded)
{
await Navigation.PopForDeviceAsync();
_userDialogs.Toast("Folder updated.");
_userDialogs.Toast(AppResources.FolderUpdated);
_googleAnalyticsService.TrackAppEvent("EditedFolder");
}
else if(saveResult.Errors.Count() > 0)
@@ -107,12 +107,12 @@ namespace Bit.App.Pages
}
}, ToolbarItemOrder.Default, 0);
Title = "Edit Folder";
Title = AppResources.EditFolder;
Content = mainTable;
ToolbarItems.Add(saveToolBarItem);
if(Device.OS == TargetPlatform.iOS)
{
ToolbarItems.Add(new DismissModalToolBarItem(this, "Cancel"));
ToolbarItems.Add(new DismissModalToolBarItem(this, AppResources.Cancel));
}
}
@@ -141,14 +141,14 @@ namespace Bit.App.Pages
}
_userDialogs.ShowLoading("Deleting...", MaskType.Black);
_userDialogs.ShowLoading(AppResources.Deleting, MaskType.Black);
var deleteTask = await _folderService.DeleteAsync(_folderId);
_userDialogs.HideLoading();
if(deleteTask.Succeeded)
{
await Navigation.PopForDeviceAsync();
_userDialogs.Toast("Folder deleted.");
_userDialogs.Toast(AppResources.FolderDeleted);
}
else if(deleteTask.Errors.Count() > 0)
{

View File

@@ -3,6 +3,7 @@ using Bit.App.Controls;
using Xamarin.Forms;
using Bit.App.Abstractions;
using XLabs.Ioc;
using Bit.App.Resources;
namespace Bit.App.Pages
{
@@ -21,7 +22,7 @@ namespace Bit.App.Pages
{
var emailCell = new ExtendedTextCell
{
Text = "Email Us",
Text = AppResources.EmailUs,
ShowDisclousure = true
};
emailCell.Tapped += EmailCell_Tapped;
@@ -39,12 +40,12 @@ namespace Bit.App.Pages
var emailLabel = new CustomLabel(this)
{
Text = "Email us directly to get help or leave feedback."
Text = AppResources.EmailUsDescription
};
var websiteCell = new ExtendedTextCell
{
Text = "Visit Our Website",
Text = AppResources.VisitOurWebsite,
ShowDisclousure = true
};
websiteCell.Tapped += WebsiteCell_Tapped;
@@ -63,12 +64,12 @@ namespace Bit.App.Pages
var websiteLabel = new CustomLabel(this)
{
Text = "Visit our website to get help, news, email us, and/or learn more about how to use bitwarden."
Text = AppResources.VisitOurWebsiteDescription
};
var bugCell = new ExtendedTextCell
{
Text = "File a Bug Report",
Text = AppResources.FileBugReport,
ShowDisclousure = true
};
bugCell.Tapped += BugCell_Tapped;
@@ -87,7 +88,7 @@ namespace Bit.App.Pages
var bugLabel = new CustomLabel(this)
{
Text = "Open an issue at our GitHub repository."
Text = AppResources.FileBugReportDescription
};
var stackLayout = new StackLayout
@@ -103,7 +104,7 @@ namespace Bit.App.Pages
bugLabel.WidthRequest = stackLayout.Bounds.Width - bugLabel.Bounds.Left * 2;
};
Title = "Help and Feedback";
Title = AppResources.HelpAndFeedback;
Content = new ScrollView { Content = stackLayout };
}

View File

@@ -38,7 +38,7 @@ namespace Bit.App.Pages
listView.ItemSelected += FolderSelected;
listView.ItemTemplate = new DataTemplate(() => new SettingsFolderListViewCell(this));
Title = "Folders";
Title = AppResources.Folders;
Content = listView;
}

View File

@@ -43,14 +43,14 @@ namespace Bit.App.Pages
{
PinCell = new ExtendedSwitchCell
{
Text = "Unlock with PIN Code",
Text = AppResources.UnlockWithPIN,
On = _settings.GetValueOrDefault(Constants.SettingPinUnlockOn, false)
};
PinCell.OnChanged += PinCell_Changed;
LockOptionsCell = new ExtendedTextCell
{
Text = "Lock Options",
Text = AppResources.LockOptions,
Detail = GetLockOptionsDetailsText(),
ShowDisclousure = true
};
@@ -58,12 +58,12 @@ namespace Bit.App.Pages
var twoStepCell = new ExtendedTextCell
{
Text = "Two-step Login",
Text = AppResources.TwoStepLogin,
ShowDisclousure = true
};
twoStepCell.Tapped += TwoStepCell_Tapped; ;
var securitySecion = new TableSection("Security")
var securitySecion = new TableSection(AppResources.Security)
{
LockOptionsCell,
PinCell,
@@ -72,10 +72,11 @@ namespace Bit.App.Pages
if(_fingerprint.IsAvailable)
{
var fingerprintName = Device.OnPlatform(iOS: "Touch ID", Android: "Fingerprint", WinPhone: "Fingerprint");
var fingerprintName = Device.OnPlatform(iOS: AppResources.TouchID, Android: AppResources.Fingerprint,
WinPhone: AppResources.Fingerprint);
FingerprintCell = new ExtendedSwitchCell
{
Text = "Unlock with " + fingerprintName,
Text = string.Format(AppResources.UnlockWith, fingerprintName),
On = _settings.GetValueOrDefault(Constants.SettingFingerprintUnlockOn, false),
IsEnabled = _fingerprint.IsAvailable
};
@@ -85,59 +86,59 @@ namespace Bit.App.Pages
var changeMasterPasswordCell = new ExtendedTextCell
{
Text = "Change Master Password",
Text = AppResources.ChangeMasterPassword,
ShowDisclousure = true
};
changeMasterPasswordCell.Tapped += ChangeMasterPasswordCell_Tapped;
var changeEmailCell = new ExtendedTextCell
{
Text = "Change Email",
Text = AppResources.ChangeEmail,
ShowDisclousure = true
};
changeEmailCell.Tapped += ChangeEmailCell_Tapped;
var foldersCell = new ExtendedTextCell
{
Text = "Folders",
Text = AppResources.Folders,
ShowDisclousure = true
};
foldersCell.Tapped += FoldersCell_Tapped;
var syncCell = new ExtendedTextCell
{
Text = "Sync",
Text = AppResources.Sync,
ShowDisclousure = true
};
syncCell.Tapped += SyncCell_Tapped;
var lockCell = new ExtendedTextCell
{
Text = "Lock"
Text = AppResources.Lock
};
lockCell.Tapped += LockCell_Tapped;
var logOutCell = new ExtendedTextCell
{
Text = "Log Out"
Text = AppResources.LogOut
};
logOutCell.Tapped += LogOutCell_Tapped;
var aboutCell = new ExtendedTextCell
{
Text = "About",
Text = AppResources.About,
ShowDisclousure = true
};
aboutCell.Tapped += AboutCell_Tapped;
var helpCell = new ExtendedTextCell
{
Text = "Help and Feedback",
Text = AppResources.HelpAndFeedback,
ShowDisclousure = true
};
helpCell.Tapped += HelpCell_Tapped;
var otherSection = new TableSection("Other")
var otherSection = new TableSection(AppResources.Other)
{
aboutCell,
helpCell
@@ -145,9 +146,7 @@ namespace Bit.App.Pages
if(Device.OS == TargetPlatform.iOS)
{
var rateCell = new LongDetailViewCell("Rate the App",
"App Store ratings are reset with every new version of bitwarden."
+ " Please consider helping us out with a good review!");
var rateCell = new LongDetailViewCell(AppResources.RateTheApp, AppResources.RateTheAppDescriptionAppStore);
rateCell.Tapped += RateCell_Tapped;
otherSection.Add(rateCell);
}
@@ -155,8 +154,8 @@ namespace Bit.App.Pages
{
var rateCell = new ExtendedTextCell
{
Text = "Rate the App",
Detail = "Please consider helping us out with a good review!",
Text = AppResources.RateTheApp,
Detail = AppResources.RateTheAppDescription,
ShowDisclousure = true,
DetailLineBreakMode = LineBreakMode.WordWrap
};
@@ -169,17 +168,17 @@ namespace Bit.App.Pages
Root = new TableRoot
{
securitySecion,
new TableSection("Account")
new TableSection(AppResources.Account)
{
changeMasterPasswordCell,
changeEmailCell
},
new TableSection("Manage")
new TableSection(AppResources.Manage)
{
foldersCell,
syncCell
},
new TableSection("Current Session")
new TableSection(AppResources.CurrentSession)
{
lockCell,
logOutCell
@@ -194,10 +193,8 @@ namespace Bit.App.Pages
private async void TwoStepCell_Tapped(object sender, EventArgs e)
{
if(!await _userDialogs.ConfirmAsync("Two-step login makes your account more secure by requiring you to enter"
+ " a security code from an authenticator app whenever you log in. Two-step login can be enabled on the"
+ " bitwarden.com web vault. Do you want to visit the website now?",
null, AppResources.Yes, AppResources.Cancel))
if(!await _userDialogs.ConfirmAsync(AppResources.TwoStepLoginConfirmation, null, AppResources.Yes,
AppResources.Cancel))
{
return;
}
@@ -208,35 +205,36 @@ namespace Bit.App.Pages
private async void LockOptionsCell_Tapped(object sender, EventArgs e)
{
var selection = await DisplayActionSheet("Lock Options", AppResources.Cancel, null,
"Immediately", "1 minute", "15 minutes", "1 hour", "4 hours", "Never");
var selection = await DisplayActionSheet(AppResources.LockOptions, AppResources.Cancel, null,
AppResources.LockOptionImmediately, AppResources.LockOption1Minute, AppResources.LockOption15Minutes,
AppResources.LockOption1Hour, AppResources.LockOption4Hours, AppResources.Never);
if(selection == AppResources.Cancel)
{
return;
}
if(selection == "Immediately")
if(selection == AppResources.LockOptionImmediately)
{
_settings.AddOrUpdateValue(Constants.SettingLockSeconds, 0);
}
else if(selection == "1 minute")
else if(selection == AppResources.LockOption1Minute)
{
_settings.AddOrUpdateValue(Constants.SettingLockSeconds, 60);
}
else if(selection == "15 minutes")
else if(selection == AppResources.LockOption15Minutes)
{
_settings.AddOrUpdateValue(Constants.SettingLockSeconds, 60 * 15);
}
else if(selection == "1 hour")
else if(selection == AppResources.LockOption1Hour)
{
_settings.AddOrUpdateValue(Constants.SettingLockSeconds, 60 * 60);
}
else if(selection == "4 hours")
else if(selection == AppResources.LockOption4Hours)
{
_settings.AddOrUpdateValue(Constants.SettingLockSeconds, 60 * 60 * 4);
}
else if(selection == "Never")
else if(selection == AppResources.Never)
{
_settings.AddOrUpdateValue(Constants.SettingLockSeconds, -1);
}
@@ -282,8 +280,7 @@ namespace Bit.App.Pages
private async void LogOutCell_Tapped(object sender, EventArgs e)
{
if(!await _userDialogs.ConfirmAsync(
"Are you sure you want to log out?", null, AppResources.Yes, AppResources.Cancel))
if(!await _userDialogs.ConfirmAsync(AppResources.LogoutConfirmation, null, AppResources.Yes, AppResources.Cancel))
{
return;
}
@@ -293,8 +290,8 @@ namespace Bit.App.Pages
private async void ChangeMasterPasswordCell_Tapped(object sender, EventArgs e)
{
if(!await _userDialogs.ConfirmAsync("You can change your master password on the bitwarden.com web vault."
+ "Do you want to visit the website now?", null, AppResources.Yes, AppResources.Cancel))
if(!await _userDialogs.ConfirmAsync(AppResources.ChangePasswordConfirmation, null, AppResources.Yes,
AppResources.Cancel))
{
return;
}
@@ -305,8 +302,8 @@ namespace Bit.App.Pages
private async void ChangeEmailCell_Tapped(object sender, EventArgs e)
{
if(!await _userDialogs.ConfirmAsync("You can change your email address on the bitwarden.com web vault."
+ " Do you want to visit the website now?", null, AppResources.Yes, AppResources.Cancel))
if(!await _userDialogs.ConfirmAsync(AppResources.ChangeEmailConfirmation, null, AppResources.Yes,
AppResources.Cancel))
{
return;
}
@@ -380,27 +377,27 @@ namespace Bit.App.Pages
var lockSeconds = _settings.GetValueOrDefault(Constants.SettingLockSeconds, 60 * 15);
if(lockSeconds == -1)
{
return "Never";
return AppResources.Never;
}
else if(lockSeconds == 60)
{
return "1 minute";
return AppResources.LockOption1Minute;
}
else if(lockSeconds == 60 * 15)
{
return "15 minutes";
return AppResources.LockOption15Minutes;
}
else if(lockSeconds == 60 * 60)
{
return "1 hour";
return AppResources.LockOption1Hour;
}
else if(lockSeconds == 60 * 60 * 4)
{
return "4 hours";
return AppResources.LockOption4Hours;
}
else
{
return "Immediately";
return AppResources.LockOptionImmediately;
}
}

View File

@@ -32,7 +32,7 @@ namespace Bit.App.Pages
{
var instructionLabel = new Label
{
Text = "Enter a 4 digit PIN code to unlock the app with.",
Text = AppResources.SetPINDirection,
LineBreakMode = LineBreakMode.WordWrap,
FontSize = Device.GetNamedSize(NamedSize.Small, typeof(Label)),
HorizontalTextAlignment = TextAlignment.Center,
@@ -56,7 +56,7 @@ namespace Bit.App.Pages
PinControl.Label.GestureRecognizers.Add(tgr);
instructionLabel.GestureRecognizers.Add(tgr);
Title = "Set PIN";
Title = AppResources.SetPIN;
Content = stackLayout;
Content.GestureRecognizers.Add(tgr);
BindingContext = Model;

View File

@@ -36,7 +36,7 @@ namespace Bit.App.Pages
{
var syncButton = new ExtendedButton
{
Text = "Sync Vault Now",
Text = AppResources.SyncVaultNow,
Command = new Command(async () => await SyncAsync()),
Style = (Style)Application.Current.Resources["btn-primaryAccent"]
};
@@ -57,7 +57,7 @@ namespace Bit.App.Pages
Padding = new Thickness(15, 0)
};
Title = "Sync";
Title = AppResources.Sync;
Content = stackLayout;
}
@@ -75,7 +75,7 @@ namespace Bit.App.Pages
var lastSyncDate = _settings.GetValueOrDefault<DateTime?>(Constants.LastSync, null);
try
{
LastSyncLabel.Text = "Last Sync: " + lastSyncDate?.ToLocalTime().ToString() ?? "Never";
LastSyncLabel.Text = AppResources.LastSync + " " + lastSyncDate?.ToLocalTime().ToString() ?? AppResources.Never;
}
catch
{
@@ -93,17 +93,17 @@ namespace Bit.App.Pages
return;
}
_userDialogs.ShowLoading("Syncing...", MaskType.Black);
_userDialogs.ShowLoading(AppResources.Syncing, MaskType.Black);
var succeeded = await _syncService.FullSyncAsync();
_userDialogs.HideLoading();
if(succeeded)
{
_userDialogs.Toast("Syncing complete.");
_userDialogs.Toast(AppResources.SyncingComplete);
_googleAnalyticsService.TrackAppEvent("Synced");
}
else
{
_userDialogs.Toast("Syncing failed.");
_userDialogs.Toast(AppResources.SyncingFailed);
}
SetLastSync();