Skip to content

armgit / ente

Public Imported from GitHub
0

💚 End-to-end encrypted cloud for everything.

Add l10n for local backup strings

Prateek Sunal0cc5fa651529
diff --git a/mobile/apps/auth/lib/l10n/arb/app_en.arb b/mobile/apps/auth/lib/l10n/arb/app_en.arb
index 85e691f00d..ebc1dc412f 100644
--- a/mobile/apps/auth/lib/l10n/arb/app_en.arb
+++ b/mobile/apps/auth/lib/l10n/arb/app_en.arb
@@ -561,6 +561,22 @@
"saveBackup":"Save backup",
"changeLocation": "Change location",
"changeCurrentLocation": "Change current location",
+ "updateBackupPassword": "Update backup password",
+ "setBackupPassword": "Set backup password",
+ "createBackupNow": "Create backup now",
+ "clearBackupFolder": "Clear backup folder",
+ "clearBackupPassword": "Clear backup password",
+ "selectBackupFolder": "Select a backup folder",
+ "backupLocation": "Backup location",
+ "changeFolder": "Change folder",
+ "backupPasswordHint": "Your backup will be encrypted with this password.",
+ "authToUpdateBackupPassword": "Authenticate to update backup password",
+ "authToSetBackupPassword": "Authenticate to set backup password",
+ "backupPasswordCleared": "Backup password cleared",
+ "enableBackupsIosInstruction": "To enable backups on iOS, choose a folder in Files (for example \"On My iPhone\").",
+ "currentBackupFolder": "Current backup folder:",
+ "selectFolder": "Select folder",
+ "selectFolderToContinue": "Select a folder to continue",
"done": "Done",
"addNew": "Add new",
"selected": "selected",
diff --git a/mobile/apps/auth/lib/ui/settings/data/local_backup/local_backup_experience.dart b/mobile/apps/auth/lib/ui/settings/data/local_backup/local_backup_experience.dart
index d85a18f91e..016d6954c4 100644
--- a/mobile/apps/auth/lib/ui/settings/data/local_backup/local_backup_experience.dart
+++ b/mobile/apps/auth/lib/ui/settings/data/local_backup/local_backup_experience.dart
@@ -14,8 +14,6 @@ import 'package:path_provider/path_provider.dart';
import 'package:saf_util/saf_util.dart';
import 'package:shared_preferences/shared_preferences.dart';
-const _passwordDialogHint = 'Your backup will be encrypted with this password.';
-
typedef LocalBackupVariantBuilder = Widget Function(
BuildContext context,
LocalBackupExperienceController controller,
@@ -130,8 +128,7 @@ class _LocalBackupExperienceState extends State<LocalBackupExperience> {
}
Future<bool> _startEnableFlow() async {
- final hasPassword =
- await _ensurePasswordConfigured(disableOnCancel: true);
+ final hasPassword = await _ensurePasswordConfigured(disableOnCancel: true);
if (!hasPassword) {
return false;
}
@@ -184,7 +181,8 @@ class _LocalBackupExperienceState extends State<LocalBackupExperience> {
});
}
- Future<bool> _ensurePasswordConfigured({required bool disableOnCancel}) async {
+ Future<bool> _ensurePasswordConfigured(
+ {required bool disableOnCancel}) async {
if (await _hasStoredPassword()) {
return true;
}
@@ -261,8 +259,7 @@ class _LocalBackupExperienceState extends State<LocalBackupExperience> {
}
}
- Future<bool> _updatePassword(BuildContext context) async =>
- _promptPassword(
+ Future<bool> _updatePassword(BuildContext context) async => _promptPassword(
forcePrompt: true,
disableOnCancel: false,
isUpdateFlow: true,
@@ -275,8 +272,8 @@ class _LocalBackupExperienceState extends State<LocalBackupExperience> {
}) async {
final hasAuthenticated = await _authenticateForBackupAction(
isUpdateFlow
- ? 'Authenticate to update backup password'
- : 'Authenticate to set backup password',
+ ? context.l10n.authToUpdateBackupPassword
+ : context.l10n.authToSetBackupPassword,
forceAuthPrompt: true,
);
if (!hasAuthenticated) {
@@ -323,7 +320,7 @@ class _LocalBackupExperienceState extends State<LocalBackupExperience> {
}
const storage = FlutterSecureStorage();
await storage.delete(key: _passwordKey);
- _showSnackBar('Backup password cleared');
+ _showSnackBar(context.l10n.backupPasswordCleared);
return true;
}
@@ -368,18 +365,20 @@ class _LocalBackupExperienceState extends State<LocalBackupExperience> {
builder: (context, setState) {
return AlertDialog(
title: Text(
- isUpdateFlow ? 'Update backup password' : 'Set backup password',
+ isUpdateFlow
+ ? l10n.updateBackupPassword
+ : l10n.setBackupPassword,
style: getEnteTextTheme(context).largeBold,
),
content: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Text(
- _passwordDialogHint,
- style: getEnteTextTheme(context).smallFaint,
- ),
- const SizedBox(height: 12),
+ children: [
+ Text(
+ l10n.backupPasswordHint,
+ style: getEnteTextTheme(context).smallFaint,
+ ),
+ const SizedBox(height: 12),
TextField(
controller: textController,
autofocus: true,
@@ -474,13 +473,13 @@ class _LocalBackupExperienceState extends State<LocalBackupExperience> {
..writeln(l10n.backupLocationChoiceDescription)
..writeln()
..writeln(
- 'To enable backups on iOS, choose a folder in Files (for example “On My iPhone”).',
+ l10n.enableBackupsIosInstruction,
)
..writeln()
..writeAll(
_backupPath != null && _backupPath!.isNotEmpty
? [
- 'Current backup folder:',
+ l10n.currentBackupFolder,
_simplifyPath(_backupPath!),
]
: const [],
@@ -491,17 +490,17 @@ class _LocalBackupExperienceState extends State<LocalBackupExperience> {
title: l10n.chooseBackupLocation,
context: context,
body: dialogBody.toString(),
- buttons: const [
+ buttons: [
ButtonWidget(
buttonType: ButtonType.primary,
- labelText: 'Select folder',
+ labelText: l10n.selectFolder,
isInAlert: true,
buttonSize: ButtonSize.large,
buttonAction: ButtonAction.second,
),
ButtonWidget(
buttonType: ButtonType.secondary,
- labelText: 'Cancel',
+ labelText: l10n.cancel,
isInAlert: true,
buttonSize: ButtonSize.large,
buttonAction: ButtonAction.first,
@@ -577,7 +576,9 @@ class _LocalBackupExperienceState extends State<LocalBackupExperience> {
const cloudDocsPrefix = 'com~apple~CloudDocs/';
if (afterMarker.startsWith(cloudDocsPrefix)) {
final remaining = afterMarker.substring(cloudDocsPrefix.length);
- return remaining.isNotEmpty ? 'iCloud Drive/$remaining' : 'iCloud Drive';
+ return remaining.isNotEmpty
+ ? 'iCloud Drive/$remaining'
+ : 'iCloud Drive';
}
if (afterMarker.isNotEmpty) {
return afterMarker;
@@ -634,7 +635,7 @@ class _LocalBackupExperienceState extends State<LocalBackupExperience> {
);
}
} else if (requireSelection) {
- _showSnackBar('Select a folder to continue');
+ _showSnackBar(context.l10n.selectFolderToContinue);
}
return saved;
} else {
@@ -656,7 +657,7 @@ class _LocalBackupExperienceState extends State<LocalBackupExperience> {
return saved;
}
if (requireSelection) {
- _showSnackBar('Select a folder to continue');
+ _showSnackBar(context.l10n.selectFolderToContinue);
}
return false;
}
diff --git a/mobile/apps/auth/lib/ui/settings/data/local_backup_settings_page.dart b/mobile/apps/auth/lib/ui/settings/data/local_backup_settings_page.dart
index e8b211488a..f1d9e95adf 100644
--- a/mobile/apps/auth/lib/ui/settings/data/local_backup_settings_page.dart
+++ b/mobile/apps/auth/lib/ui/settings/data/local_backup_settings_page.dart
@@ -62,8 +62,8 @@ class LocalBackupSettingsPage extends StatelessWidget {
builder: (context, snapshot) {
final hasPassword = snapshot.data ?? false;
final tileTitle = hasPassword
- ? 'Update backup password'
- : 'Set backup password';
+ ? l10n.updateBackupPassword
+ : l10n.setBackupPassword;
return MenuItemWidget(
captionedTextWidget: CaptionedTextWidget(
title: tileTitle,
@@ -76,19 +76,19 @@ class LocalBackupSettingsPage extends StatelessWidget {
onTap: () async {
await controller.updatePassword(context);
},
- );
- },
- ),
- const SizedBox(height: 16),
- _BackupLocationCard(
- controller: controller,
- colorScheme: colorScheme,
- textTheme: textTheme,
- ),
+ );
+ },
+ ),
+ const SizedBox(height: 16),
+ _BackupLocationCard(
+ controller: controller,
+ colorScheme: colorScheme,
+ textTheme: textTheme,
+ ),
const SizedBox(height: 12),
MenuItemWidget(
- captionedTextWidget: const CaptionedTextWidget(
- title: 'Create backup now',
+ captionedTextWidget: CaptionedTextWidget(
+ title: l10n.createBackupNow,
),
alignCaptionedTextToLeft: true,
singleBorderRadius: 12,
@@ -119,14 +119,14 @@ class LocalBackupSettingsPage extends StatelessWidget {
children: [
_BackupButton(
onPressed: controller.resetBackupLocation,
- label: 'Clear backup folder',
+ label: l10n.clearBackupFolder,
colorScheme: colorScheme,
textTheme: textTheme,
),
const SizedBox(height: 10),
_BackupButton(
onPressed: controller.clearBackupPassword,
- label: 'Clear backup password',
+ label: l10n.clearBackupPassword,
colorScheme: colorScheme,
textTheme: textTheme,
),
@@ -204,7 +204,7 @@ class _LocationPreview extends StatelessWidget {
);
}
- return Text('Select a backup folder', style: muted);
+ return Text(context.l10n.selectBackupFolder, style: muted);
}
}
@@ -242,7 +242,7 @@ class _BackupLocationCard extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
- 'Backup location',
+ context.l10n.backupLocation,
style: textTheme.body,
),
const SizedBox(height: 6),
@@ -264,7 +264,7 @@ class _BackupLocationCard extends StatelessWidget {
minimumSize: const Size(0, 44),
),
child: Text(
- 'Change folder',
+ context.l10n.changeFolder,
style: textTheme.smallBold,
),
),