CAKE-243 | added localization to backup_page.dart, edit_backup_password_page.dart, wallet_menu.dart, restore_from_backup_page.dart

This commit is contained in:
OleksandrSobol
2021-01-20 21:27:03 +02:00
parent 6639d25264
commit a5240236d4
17 changed files with 571 additions and 45 deletions
+18 -18
View File
@@ -20,11 +20,11 @@ class BackupPage extends BasePage {
final BackupViewModelBase backupViewModelBase;
@override
String get title => 'Backup';
String get title => S.current.backup;
@override
Widget trailing(BuildContext context) => TrailButton(
caption: 'Change password',
caption: S.of(context).change_password,
onPressed: () =>
Navigator.of(context).pushNamed(Routes.editBackupPassword));
@@ -39,7 +39,8 @@ class BackupPage extends BasePage {
height: 300,
child: Column(children: [
Text(
'Backup password:',
S.of(context).backup_password + ':',
textAlign: TextAlign.center,
style: TextStyle(fontSize: 30),
),
Padding(
@@ -53,7 +54,7 @@ class BackupPage extends BasePage {
showBar<void>(
context,
S.of(context).transaction_details_copied(
'Backup password'));
S.of(context).backup_password));
},
child: Text(
backupViewModelBase.backupPassword,
@@ -64,7 +65,7 @@ class BackupPage extends BasePage {
Padding(
padding: EdgeInsets.all(20),
child: Text(
'Please write down your Backup Password. Backup Password uses for import of backup files.',
S.of(context).write_down_backup_password,
style: TextStyle(fontSize: 14, color: Colors.grey),
textAlign: TextAlign.center,
))
@@ -74,7 +75,7 @@ class BackupPage extends BasePage {
builder: (_) => LoadingPrimaryButton(
isLoading: backupViewModelBase.state is IsExecutingState,
onPressed: () => onExportBackup(context),
text: 'Export backup',
text: S.of(context).export_backup,
color: Theme.of(context).accentTextTheme.body2.color,
textColor: Colors.white)),
bottom: 30,
@@ -90,18 +91,17 @@ class BackupPage extends BasePage {
context: context,
builder: (dialogContext) {
return AlertWithTwoActions(
alertTitle: 'Export backup',
alertContent:
'Please be sure that you have saved your Backup Password.You will be no available to import backup files without Backup Password.\n\nHave you written it down?',
rightButtonText: S.of(context).seed_alert_yes,
leftButtonText: S.of(context).seed_alert_back,
actionRightButton: () async {
Navigator.of(dialogContext).pop();
final backup = await backupViewModelBase.exportBackup();
await Share.file(
'Backup file', backup.name, backup.content, 'text');
},
actionLeftButton: () => Navigator.of(dialogContext).pop());
alertTitle: S.of(context).export_backup,
alertContent: S.of(context).save_backup_password,
rightButtonText: S.of(context).seed_alert_yes,
leftButtonText: S.of(context).seed_alert_back,
actionRightButton: () async {
Navigator.of(dialogContext).pop();
final backup = await backupViewModelBase.exportBackup();
await Share.file(
S.of(context).backup_file, backup.name, backup.content, 'text');
},
actionLeftButton: () => Navigator.of(dialogContext).pop());
});
}
}
@@ -20,7 +20,7 @@ class EditBackupPasswordPage extends BasePage {
final TextEditingController textEditingController;
@override
String get title => 'Edit Backup Password';
String get title => S.current.edit_backup_password;
@override
Widget body(BuildContext context) {
@@ -37,12 +37,14 @@ class EditBackupPasswordPage extends BasePage {
autocorrect: false,
keyboardType: TextInputType.visiblePassword,
controller: textEditingController,
style: TextStyle(fontSize: 26, color: Theme.of(context).primaryTextTheme.title.color)))),
style: TextStyle(
fontSize: 26,
color: Theme.of(context).primaryTextTheme.title.color)))),
Positioned(
child: Observer(
builder: (_) => PrimaryButton(
onPressed: () => onSave(context),
text: 'Save',
text: S.of(context).save,
color: Theme.of(context).accentTextTheme.body2.color,
textColor: Colors.white,
isDisabled: !editBackupPasswordViewModel.canSave)),
@@ -58,9 +60,8 @@ class EditBackupPasswordPage extends BasePage {
context: context,
builder: (dialogContext) {
return AlertWithTwoActions(
alertTitle: 'Save backup password',
alertContent:
'Your previous backup files will be not available to import with new backup password. New backup password will be used only for new backup files. Are you sure that you want to change backup password ?',
alertTitle: S.of(context).save_backup_password_alert,
alertContent: S.of(context).change_backup_password_alert,
rightButtonText: S.of(context).ok,
leftButtonText: S.of(context).cancel,
actionRightButton: () async {
+1 -1
View File
@@ -38,7 +38,7 @@ class WalletMenu {
image: Image.asset('assets/images/open_book_menu.png',
height: 16, width: 16)),
WalletMenuItem(
title: 'Backup',
title: S.current.backup,
image: Image.asset('assets/images/restore_wallet.png',
height: 16,
width: 16,
@@ -19,7 +19,7 @@ class RestoreFromBackupPage extends BasePage {
final TextEditingController textEditingController;
@override
String get title => 'Restore from backup';
String get title => S.current.restore_title_from_backup;
@override
Widget body(BuildContext context) {
@@ -50,7 +50,7 @@ class RestoreFromBackupPage extends BasePage {
enableSuggestions: false,
autocorrect: false,
decoration: InputDecoration(
hintText: 'Enter backup password here'),
hintText: S.of(context).enter_backup_password),
keyboardType: TextInputType.visiblePassword,
controller: textEditingController,
style: TextStyle(fontSize: 26, color: Colors.black))),
@@ -61,7 +61,7 @@ class RestoreFromBackupPage extends BasePage {
Expanded(
child: PrimaryButton(
onPressed: () => presentFilePicker(),
text: 'Select backup file',
text: S.of(context).select_backup_file,
color: Colors.grey,
textColor: Colors.white)),
SizedBox(width: 20),
@@ -70,7 +70,7 @@ class RestoreFromBackupPage extends BasePage {
isLoading:
restoreFromBackupViewModel.state is IsExecutingState,
onPressed: () => onImportHandler(context),
text: 'Import',
text: S.of(context).import,
color: Theme.of(context).accentTextTheme.body2.color,
textColor: Colors.white);
}))
@@ -96,8 +96,7 @@ class RestoreFromBackupPage extends BasePage {
builder: (_) {
return AlertWithOneAction(
alertTitle: S.current.error,
alertContent:
'Please select backup file and enter backup password.',
alertContent: S.of(context).please_select_backup_file,
buttonText: S.of(context).ok,
buttonAction: () => Navigator.of(context).pop());
});