From aa558fd35d40c5ece95a7f3c688080a120aadade Mon Sep 17 00:00:00 2001 From: Neeraj Gupta <254676+ua741@users.noreply.github.com> Date: Sat, 15 Apr 2023 11:42:05 +0530 Subject: [PATCH] Extract strings --- lib/l10n/arb/app_en.arb | 22 ++++++++++++++- lib/ui/settings/data_section_widget.dart | 34 +++++++++++------------- 2 files changed, 36 insertions(+), 20 deletions(-) diff --git a/lib/l10n/arb/app_en.arb b/lib/l10n/arb/app_en.arb index c2b9d57074..c23174d9bf 100644 --- a/lib/l10n/arb/app_en.arb +++ b/lib/l10n/arb/app_en.arb @@ -203,5 +203,25 @@ "terms": "Terms", "checkForUpdates": "Check for updates", "checking": "Checking...", - "youAreOnTheLatestVersion": "You are on the latest version" + "youAreOnTheLatestVersion": "You are on the latest version", + "warning": "Warning", + "exportWarningDesc": "The exported file contains sensitive information. Please store this safely.", + "iUnderStand" : "I understand", + "@iUnderStand": { + "description": "Text for the button to confirm the user understands the warning" + }, + "authToExportCodes": "Please authenticate to export your codes", + "importSuccessTitle": "Yay!", + "importSuccessDesc": "You have imported {count} codes!", + "@importSuccessDes" : { + "placeholders": { + "count": { + "description": "The number of codes imported", + "type": "int", + "example": "1" + } + } + }, + "sorry" : "Sorry", + "importFailureDesc": "Could not parse the selected file.\nPlease write to support@ente.io if you need help!" } diff --git a/lib/ui/settings/data_section_widget.dart b/lib/ui/settings/data_section_widget.dart index 73be0e7b6f..79053c55d4 100644 --- a/lib/ui/settings/data_section_widget.dart +++ b/lib/ui/settings/data_section_widget.dart @@ -1,5 +1,3 @@ - - import 'dart:async'; import 'dart:io'; import 'dart:ui'; @@ -151,17 +149,17 @@ class DataSectionWidget extends StatelessWidget { final AlertDialog alert = AlertDialog( shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(10)), title: Text( - "Warning", + context.l10n.warning, style: Theme.of(context).textTheme.headline6, ), - content: const Text( - "The exported file contains sensitive information. Please store this safely.", + content: Text( + context.l10n.exportWarningDesc, ), actions: [ TextButton( - child: const Text( - "I understand", - style: TextStyle( + child: Text( + context.l10n.iUnderStand, + style: const TextStyle( color: Colors.red, ), ), @@ -171,8 +169,8 @@ class DataSectionWidget extends StatelessWidget { }, ), TextButton( - child: const Text( - "Cancel", + child: Text( + context.l10n.cancel, ), onPressed: () { Navigator.of(context, rootNavigator: true).pop('dialog'); @@ -191,11 +189,8 @@ class DataSectionWidget extends StatelessWidget { } Future _exportCodes(BuildContext context) async { - final hasAuthenticated = - await LocalAuthenticationService.instance.requestLocalAuthentication( - context, - "Please authenticate to export your codes", - ); + final hasAuthenticated = await LocalAuthenticationService.instance + .requestLocalAuthentication(context, context.l10n.authToExportCodes); if (!hasAuthenticated) { return; } @@ -245,8 +240,9 @@ class DataSectionWidget extends StatelessWidget { unawaited(AuthenticatorService.instance.sync()); final DialogWidget dialog = choiceDialog( - title: "Yay!", - body: "You have imported " + parsedCodes.length.toString() + " codes!", + title: context.l10n.importSuccessTitle, + body: context.l10n.importSuccessDesc(parsedCodes.length), + // body: "You have imported " + parsedCodes.length.toString() + " codes!", firstButtonLabel: l10n.ok, firstButtonOnTap: () async { Navigator.of(context, rootNavigator: true).pop('dialog'); @@ -263,8 +259,8 @@ class DataSectionWidget extends StatelessWidget { await dialog.hide(); await showErrorDialog( context, - "Sorry", - "Could not parse the selected file.\nPlease write to support@ente.io if you need help!", + context.l10n.sorry, + context.l10n.importFailureDesc, ); } }