i18n resource strings for app extension

This commit is contained in:
Kyle Spearrin 2016-11-25 17:05:14 -05:00
parent 8322e49305
commit d8559a81f4
11 changed files with 141 additions and 29 deletions

View file

@ -115,7 +115,8 @@ namespace Bit.App.Pages
{ {
if(string.IsNullOrWhiteSpace(PasswordCell.Entry.Text)) if(string.IsNullOrWhiteSpace(PasswordCell.Entry.Text))
{ {
await DisplayAlert(AppResources.AnErrorHasOccurred, string.Format(AppResources.ValidationFieldRequired, AppResources.MasterPassword), AppResources.Ok); await DisplayAlert(AppResources.AnErrorHasOccurred, string.Format(AppResources.ValidationFieldRequired,
AppResources.MasterPassword), AppResources.Ok);
return; return;
} }

View file

@ -304,6 +304,33 @@ namespace Bit.App.Resources {
} }
} }
/// <summary>
/// Looks up a localized string similar to Copied!.
/// </summary>
public static string Copied {
get {
return ResourceManager.GetString("Copied", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Copied password!.
/// </summary>
public static string CopiedPassword {
get {
return ResourceManager.GetString("CopiedPassword", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Copied username!.
/// </summary>
public static string CopiedUsername {
get {
return ResourceManager.GetString("CopiedUsername", resourceCulture);
}
}
/// <summary> /// <summary>
/// Looks up a localized string similar to Copy. /// Looks up a localized string similar to Copy.
/// </summary> /// </summary>
@ -556,6 +583,24 @@ namespace Bit.App.Resources {
} }
} }
/// <summary>
/// Looks up a localized string similar to Your logins are now easily accessable from Safari, Chrome, and other supported apps..
/// </summary>
public static string ExtensionSetup {
get {
return ResourceManager.GetString("ExtensionSetup", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to In Safari and Chrome, find bitwarden using the share icon (hint: scroll to the right on the bottom row of the share menu)..
/// </summary>
public static string ExtensionSetup2 {
get {
return ResourceManager.GetString("ExtensionSetup2", resourceCulture);
}
}
/// <summary> /// <summary>
/// Looks up a localized string similar to Tap the bitwarden icon in the menu to launch the extension.. /// Looks up a localized string similar to Tap the bitwarden icon in the menu to launch the extension..
/// </summary> /// </summary>
@ -1033,6 +1078,15 @@ namespace Bit.App.Resources {
} }
} }
/// <summary>
/// Looks up a localized string similar to You must log into the main bitwarden app before you can use the extension..
/// </summary>
public static string MustLogInMainApp {
get {
return ResourceManager.GetString("MustLogInMainApp", resourceCulture);
}
}
/// <summary> /// <summary>
/// Looks up a localized string similar to My Vault. /// Looks up a localized string similar to My Vault.
/// </summary> /// </summary>
@ -1096,6 +1150,15 @@ namespace Bit.App.Resources {
} }
} }
/// <summary>
/// Looks up a localized string similar to There are no sites in your vault for this website. Tap to add one..
/// </summary>
public static string NoSitesTap {
get {
return ResourceManager.GetString("NoSitesTap", resourceCulture);
}
}
/// <summary> /// <summary>
/// Looks up a localized string similar to Notes. /// Looks up a localized string similar to Notes.
/// </summary> /// </summary>
@ -1105,6 +1168,15 @@ namespace Bit.App.Resources {
} }
} }
/// <summary>
/// Looks up a localized string similar to This site does not have a username or password configured..
/// </summary>
public static string NoUsernamePasswordConfigured {
get {
return ResourceManager.GetString("NoUsernamePasswordConfigured", resourceCulture);
}
}
/// <summary> /// <summary>
/// Looks up a localized string similar to Ok. /// Looks up a localized string similar to Ok.
/// </summary> /// </summary>
@ -1123,6 +1195,15 @@ namespace Bit.App.Resources {
} }
} }
/// <summary>
/// Looks up a localized string similar to Option defaults are set from the main bitwarden app&apos;s password generator tool..
/// </summary>
public static string OptionDefaults {
get {
return ResourceManager.GetString("OptionDefaults", resourceCulture);
}
}
/// <summary> /// <summary>
/// Looks up a localized string similar to Options. /// Looks up a localized string similar to Options.
/// </summary> /// </summary>

View file

@ -448,6 +448,15 @@
<data name="Continue" xml:space="preserve"> <data name="Continue" xml:space="preserve">
<value>Continue</value> <value>Continue</value>
</data> </data>
<data name="Copied" xml:space="preserve">
<value>Copied!</value>
</data>
<data name="CopiedPassword" xml:space="preserve">
<value>Copied password!</value>
</data>
<data name="CopiedUsername" xml:space="preserve">
<value>Copied username!</value>
</data>
<data name="CreateAccount" xml:space="preserve"> <data name="CreateAccount" xml:space="preserve">
<value>Create Account</value> <value>Create Account</value>
</data> </data>
@ -492,6 +501,12 @@
<data name="ExtensionSeeApps" xml:space="preserve"> <data name="ExtensionSeeApps" xml:space="preserve">
<value>See Supported Apps</value> <value>See Supported Apps</value>
</data> </data>
<data name="ExtensionSetup" xml:space="preserve">
<value>Your logins are now easily accessable from Safari, Chrome, and other supported apps.</value>
</data>
<data name="ExtensionSetup2" xml:space="preserve">
<value>In Safari and Chrome, find bitwarden using the share icon (hint: scroll to the right on the bottom row of the share menu).</value>
</data>
<data name="ExtensionTapIcon" xml:space="preserve"> <data name="ExtensionTapIcon" xml:space="preserve">
<value>Tap the bitwarden icon in the menu to launch the extension.</value> <value>Tap the bitwarden icon in the menu to launch the extension.</value>
</data> </data>
@ -582,6 +597,9 @@
<data name="MoreSettings" xml:space="preserve"> <data name="MoreSettings" xml:space="preserve">
<value>More Settings</value> <value>More Settings</value>
</data> </data>
<data name="MustLogInMainApp" xml:space="preserve">
<value>You must log into the main bitwarden app before you can use the extension.</value>
</data>
<data name="Never" xml:space="preserve"> <data name="Never" xml:space="preserve">
<value>Never</value> <value>Never</value>
</data> </data>
@ -594,10 +612,19 @@
<data name="NoSites" xml:space="preserve"> <data name="NoSites" xml:space="preserve">
<value>There are no sites in your vault.</value> <value>There are no sites in your vault.</value>
</data> </data>
<data name="NoSitesTap" xml:space="preserve">
<value>There are no sites in your vault for this website. Tap to add one.</value>
</data>
<data name="NoUsernamePasswordConfigured" xml:space="preserve">
<value>This site does not have a username or password configured.</value>
</data>
<data name="OkGotIt" xml:space="preserve"> <data name="OkGotIt" xml:space="preserve">
<value>Ok, got it!</value> <value>Ok, got it!</value>
<comment>Confirmation, like "Ok, I understand it"</comment> <comment>Confirmation, like "Ok, I understand it"</comment>
</data> </data>
<data name="OptionDefaults" xml:space="preserve">
<value>Option defaults are set from the main bitwarden app's password generator tool.</value>
</data>
<data name="Options" xml:space="preserve"> <data name="Options" xml:space="preserve">
<value>Options</value> <value>Options</value>
</data> </data>

View file

@ -90,8 +90,7 @@ namespace Bit.iOS.Extension
var authService = Resolver.Resolve<IAuthService>(); var authService = Resolver.Resolve<IAuthService>();
if(!authService.IsAuthenticated) if(!authService.IsAuthenticated)
{ {
var alert = Dialogs.CreateAlert(null, var alert = Dialogs.CreateAlert(null, AppResources.MustLogInMainApp, AppResources.Ok, (a) =>
"You must log into the main bitwarden app before you can use the extension.", AppResources.Ok, (a) =>
{ {
CompleteRequest(null); CompleteRequest(null);
}); });

View file

@ -7,6 +7,7 @@ using Plugin.Fingerprint.Abstractions;
using System.Threading.Tasks; using System.Threading.Tasks;
using Bit.App; using Bit.App;
using Bit.iOS.Core.Controllers; using Bit.iOS.Core.Controllers;
using Bit.App.Resources;
namespace Bit.iOS.Extension namespace Bit.iOS.Extension
{ {
@ -67,7 +68,7 @@ namespace Bit.iOS.Extension
public async Task CheckFingerprintAsync() public async Task CheckFingerprintAsync()
{ {
var result = await _fingerprint.AuthenticateAsync("Use your fingerprint to verify."); var result = await _fingerprint.AuthenticateAsync(AppResources.FingerprintDirection);
if(result.Authenticated) if(result.Authenticated)
{ {
_settings.AddOrUpdateValue(Constants.Locked, false); _settings.AddOrUpdateValue(Constants.Locked, false);

View file

@ -94,7 +94,7 @@ namespace Bit.iOS.Extension
// TODO: keep track of invalid attempts and logout? // TODO: keep track of invalid attempts and logout?
var alert = Dialogs.CreateAlert(AppResources.AnErrorHasOccurred, var alert = Dialogs.CreateAlert(AppResources.AnErrorHasOccurred,
string.Format(null, "Invalid Master Password. Try again."), AppResources.Ok, (a) => string.Format(null, AppResources.InvalidMasterPassword), AppResources.Ok, (a) =>
{ {
MasterPasswordCell.TextField.Text = string.Empty; MasterPasswordCell.TextField.Text = string.Empty;

View file

@ -73,7 +73,7 @@ namespace Bit.iOS.Extension
{ {
// TODO: keep track of invalid attempts and logout? // TODO: keep track of invalid attempts and logout?
var alert = Dialogs.CreateAlert(null, "Invalid PIN. Try again.", AppResources.Ok, (a) => var alert = Dialogs.CreateAlert(null, AppResources.InvalidPIN, AppResources.Ok, (a) =>
{ {
PinTextField.Text = string.Empty; PinTextField.Text = string.Empty;
SetLabelText(); SetLabelText();

View file

@ -11,6 +11,7 @@ using CoreGraphics;
using Bit.App; using Bit.App;
using Bit.iOS.Core.Utilities; using Bit.iOS.Core.Utilities;
using Bit.iOS.Core.Controllers; using Bit.iOS.Core.Controllers;
using Bit.App.Resources;
namespace Bit.iOS.Extension namespace Bit.iOS.Extension
{ {
@ -30,9 +31,9 @@ namespace Bit.iOS.Extension
public SwitchTableViewCell LowercaseCell { get; set; } = new SwitchTableViewCell("a-z"); public SwitchTableViewCell LowercaseCell { get; set; } = new SwitchTableViewCell("a-z");
public SwitchTableViewCell NumbersCell { get; set; } = new SwitchTableViewCell("0-9"); public SwitchTableViewCell NumbersCell { get; set; } = new SwitchTableViewCell("0-9");
public SwitchTableViewCell SpecialCell { get; set; } = new SwitchTableViewCell("!@#$%^&*"); public SwitchTableViewCell SpecialCell { get; set; } = new SwitchTableViewCell("!@#$%^&*");
public StepperTableViewCell MinNumbersCell { get; set; } = new StepperTableViewCell("Minimum Numbers", 1, 0, 5, 1); public StepperTableViewCell MinNumbersCell { get; set; } = new StepperTableViewCell(AppResources.MinNumbers, 1, 0, 5, 1);
public StepperTableViewCell MinSpecialCell { get; set; } = new StepperTableViewCell("Minimum Special", 1, 0, 5, 1); public StepperTableViewCell MinSpecialCell { get; set; } = new StepperTableViewCell(AppResources.MinSpecial, 1, 0, 5, 1);
public SliderTableViewCell LengthCell { get; set; } = new SliderTableViewCell("Length", 10, 5, 64); public SliderTableViewCell LengthCell { get; set; } = new SliderTableViewCell(AppResources.Length, 10, 5, 64);
public override void ViewWillAppear(bool animated) public override void ViewWillAppear(bool animated)
{ {
@ -202,11 +203,11 @@ namespace Bit.iOS.Extension
cell.TextLabel.TextColor = new UIColor(red: 0.24f, green: 0.55f, blue: 0.74f, alpha: 1.0f); cell.TextLabel.TextColor = new UIColor(red: 0.24f, green: 0.55f, blue: 0.74f, alpha: 1.0f);
if(indexPath.Row == 0) if(indexPath.Row == 0)
{ {
cell.TextLabel.Text = "Regenerate Password"; cell.TextLabel.Text = AppResources.RegeneratePassword;
} }
else if(indexPath.Row == 1) else if(indexPath.Row == 1)
{ {
cell.TextLabel.Text = "Copy Password"; cell.TextLabel.Text = AppResources.CopyPassword;
} }
return cell; return cell;
} }
@ -290,7 +291,7 @@ namespace Bit.iOS.Extension
{ {
if(section == 1) if(section == 1)
{ {
return "Options"; return AppResources.Options;
} }
return null; return null;
@ -300,7 +301,7 @@ namespace Bit.iOS.Extension
{ {
if(section == 1) if(section == 1)
{ {
return "Option defaults are set from the main bitwarden app's password generator tool."; return AppResources.OptionDefaults;
} }
return null; return null;
@ -320,7 +321,7 @@ namespace Bit.iOS.Extension
_controller._googleAnalyticsService.TrackExtensionEvent("CopiedGeneratedPassword"); _controller._googleAnalyticsService.TrackExtensionEvent("CopiedGeneratedPassword");
UIPasteboard clipboard = UIPasteboard.General; UIPasteboard clipboard = UIPasteboard.General;
clipboard.String = _controller.PasswordLabel.Text; clipboard.String = _controller.PasswordLabel.Text;
var alert = Dialogs.CreateMessageAlert("Copied!"); var alert = Dialogs.CreateMessageAlert(AppResources.Copied);
_controller.PresentViewController(alert, true, () => _controller.PresentViewController(alert, true, () =>
{ {
_controller.DismissViewController(true, null); _controller.DismissViewController(true, null);

View file

@ -3,6 +3,7 @@ using Bit.iOS.Extension.Models;
using UIKit; using UIKit;
using Plugin.Settings.Abstractions; using Plugin.Settings.Abstractions;
using Bit.iOS.Core.Controllers; using Bit.iOS.Core.Controllers;
using Bit.App.Resources;
namespace Bit.iOS.Extension namespace Bit.iOS.Extension
{ {
@ -25,9 +26,9 @@ namespace Bit.iOS.Extension
{ {
View.BackgroundColor = new UIColor(red: 0.94f, green: 0.94f, blue: 0.96f, alpha: 1.0f); View.BackgroundColor = new UIColor(red: 0.94f, green: 0.94f, blue: 0.96f, alpha: 1.0f);
var descriptor = UIFontDescriptor.PreferredBody; var descriptor = UIFontDescriptor.PreferredBody;
DescriptionLabel.Text = @"Your logins are now easily accessable from Safari, Chrome, and other supported apps. DescriptionLabel.Text = $@"{AppResources.ExtensionSetup}
In Safari and Chrome, find bitwarden using the share icon (hint: scroll to the right on the bottom row of the share menu)."; {AppResources.ExtensionSetup2}";
DescriptionLabel.Font = UIFont.FromDescriptor(descriptor, descriptor.PointSize); DescriptionLabel.Font = UIFont.FromDescriptor(descriptor, descriptor.PointSize);
DescriptionLabel.TextColor = new UIColor(red: 0.47f, green: 0.47f, blue: 0.47f, alpha: 1.0f); DescriptionLabel.TextColor = new UIColor(red: 0.47f, green: 0.47f, blue: 0.47f, alpha: 1.0f);
ActivatedLabel.Font = UIFont.FromDescriptor(descriptor, descriptor.PointSize * 1.3f); ActivatedLabel.Font = UIFont.FromDescriptor(descriptor, descriptor.PointSize * 1.3f);

View file

@ -36,7 +36,7 @@ namespace Bit.iOS.Extension
public FormEntryTableViewCell UsernameCell { get; set; } = new FormEntryTableViewCell(AppResources.Username); public FormEntryTableViewCell UsernameCell { get; set; } = new FormEntryTableViewCell(AppResources.Username);
public FormEntryTableViewCell PasswordCell { get; set; } = new FormEntryTableViewCell(AppResources.Password); public FormEntryTableViewCell PasswordCell { get; set; } = new FormEntryTableViewCell(AppResources.Password);
public UITableViewCell GeneratePasswordCell { get; set; } = new UITableViewCell(UITableViewCellStyle.Subtitle, "GeneratePasswordCell"); public UITableViewCell GeneratePasswordCell { get; set; } = new UITableViewCell(UITableViewCellStyle.Subtitle, "GeneratePasswordCell");
public SwitchTableViewCell FavoriteCell { get; set; } = new SwitchTableViewCell("Favorite"); public SwitchTableViewCell FavoriteCell { get; set; } = new SwitchTableViewCell(AppResources.Favorite);
public FormEntryTableViewCell NotesCell { get; set; } = new FormEntryTableViewCell(useTextView: true, height: 90); public FormEntryTableViewCell NotesCell { get; set; } = new FormEntryTableViewCell(useTextView: true, height: 90);
public PickerTableViewCell FolderCell { get; set; } = new PickerTableViewCell(AppResources.Folder); public PickerTableViewCell FolderCell { get; set; } = new PickerTableViewCell(AppResources.Folder);
@ -91,7 +91,7 @@ namespace Bit.iOS.Extension
return true; return true;
}; };
GeneratePasswordCell.TextLabel.Text = "Generate Password"; GeneratePasswordCell.TextLabel.Text = AppResources.GeneratePassword;
GeneratePasswordCell.Accessory = UITableViewCellAccessory.DisclosureIndicator; GeneratePasswordCell.Accessory = UITableViewCellAccessory.DisclosureIndicator;
_folders = _folderService.GetAllAsync().GetAwaiter().GetResult(); _folders = _folderService.GetAllAsync().GetAwaiter().GetResult();
@ -160,7 +160,7 @@ namespace Bit.iOS.Extension
}; };
var saveTask = _siteService.SaveAsync(site); var saveTask = _siteService.SaveAsync(site);
var loadingAlert = Dialogs.CreateLoadingAlert("Saving..."); var loadingAlert = Dialogs.CreateLoadingAlert(AppResources.Saving);
PresentViewController(loadingAlert, true, null); PresentViewController(loadingAlert, true, null);
await saveTask; await saveTask;
@ -299,11 +299,11 @@ namespace Bit.iOS.Extension
{ {
if(section == 0) if(section == 0)
{ {
return "Site Information"; return AppResources.SiteInformation;
} }
else if(section == 2) else if(section == 2)
{ {
return "Notes"; return AppResources.Notes;
} }
return null; return null;

View file

@ -13,6 +13,7 @@ using System.Threading.Tasks;
using Bit.iOS.Core; using Bit.iOS.Core;
using MobileCoreServices; using MobileCoreServices;
using Bit.iOS.Core.Controllers; using Bit.iOS.Core.Controllers;
using Bit.App.Resources;
namespace Bit.iOS.Extension namespace Bit.iOS.Extension
{ {
@ -36,7 +37,7 @@ namespace Bit.iOS.Extension
base.ViewDidLoad(); base.ViewDidLoad();
if(!CanAutoFill()) if(!CanAutoFill())
{ {
CancelBarButton.Title = "Close"; CancelBarButton.Title = AppResources.Close;
} }
TableView.RowHeight = UITableView.AutomaticDimension; TableView.RowHeight = UITableView.AutomaticDimension;
@ -132,7 +133,7 @@ namespace Bit.iOS.Extension
if(_tableItems.Count() == 0) if(_tableItems.Count() == 0)
{ {
var noDataCell = new UITableViewCell(UITableViewCellStyle.Default, "NoDataCell"); var noDataCell = new UITableViewCell(UITableViewCellStyle.Default, "NoDataCell");
noDataCell.TextLabel.Text = "There are no sites in your vault for this website. Tap to add one."; noDataCell.TextLabel.Text = AppResources.NoSitesTap;
noDataCell.TextLabel.TextAlignment = UITextAlignment.Center; noDataCell.TextLabel.TextAlignment = UITextAlignment.Center;
noDataCell.TextLabel.LineBreakMode = UILineBreakMode.WordWrap; noDataCell.TextLabel.LineBreakMode = UILineBreakMode.WordWrap;
noDataCell.TextLabel.Lines = 0; noDataCell.TextLabel.Lines = 0;
@ -190,11 +191,11 @@ namespace Bit.iOS.Extension
var sheet = Dialogs.CreateActionSheet(item.Name, _controller); var sheet = Dialogs.CreateActionSheet(item.Name, _controller);
if(!string.IsNullOrWhiteSpace(item.Username)) if(!string.IsNullOrWhiteSpace(item.Username))
{ {
sheet.AddAction(UIAlertAction.Create("Copy Username", UIAlertActionStyle.Default, a => sheet.AddAction(UIAlertAction.Create(AppResources.CopyUsername, UIAlertActionStyle.Default, a =>
{ {
UIPasteboard clipboard = UIPasteboard.General; UIPasteboard clipboard = UIPasteboard.General;
clipboard.String = item.Username; clipboard.String = item.Username;
var alert = Dialogs.CreateMessageAlert("Copied username!"); var alert = Dialogs.CreateMessageAlert(AppResources.CopyUsername);
_controller.PresentViewController(alert, true, () => _controller.PresentViewController(alert, true, () =>
{ {
_controller.DismissViewController(true, null); _controller.DismissViewController(true, null);
@ -204,11 +205,11 @@ namespace Bit.iOS.Extension
if(!string.IsNullOrWhiteSpace(item.Password)) if(!string.IsNullOrWhiteSpace(item.Password))
{ {
sheet.AddAction(UIAlertAction.Create("Copy Password", UIAlertActionStyle.Default, a => sheet.AddAction(UIAlertAction.Create(AppResources.CopyPassword, UIAlertActionStyle.Default, a =>
{ {
UIPasteboard clipboard = UIPasteboard.General; UIPasteboard clipboard = UIPasteboard.General;
clipboard.String = item.Password; clipboard.String = item.Password;
var alert = Dialogs.CreateMessageAlert("Copied password!"); var alert = Dialogs.CreateMessageAlert(AppResources.CopiedPassword);
_controller.PresentViewController(alert, true, () => _controller.PresentViewController(alert, true, () =>
{ {
_controller.DismissViewController(true, null); _controller.DismissViewController(true, null);
@ -216,12 +217,12 @@ namespace Bit.iOS.Extension
})); }));
} }
sheet.AddAction(UIAlertAction.Create("Cancel", UIAlertActionStyle.Cancel, null)); sheet.AddAction(UIAlertAction.Create(AppResources.Cancel, UIAlertActionStyle.Cancel, null));
_controller.PresentViewController(sheet, true, null); _controller.PresentViewController(sheet, true, null);
} }
else else
{ {
var alert = Dialogs.CreateAlert(null, "This site does not have a username or password configured.", "Ok"); var alert = Dialogs.CreateAlert(null, AppResources.NoUsernamePasswordConfigured, AppResources.Ok);
_controller.PresentViewController(alert, true, null); _controller.PresentViewController(alert, true, null);
} }
} }