From 624ca39fff40f2d60a4bf503de58e353748e7450 Mon Sep 17 00:00:00 2001 From: Neeraj Gupta <254676+ua741@users.noreply.github.com> Date: Sat, 8 Apr 2023 09:38:10 +0530 Subject: [PATCH] l10n: extract strings --- lib/l10n/arb/app_en.arb | 5 ++++- lib/ui/code_widget.dart | 15 +++++++-------- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/lib/l10n/arb/app_en.arb b/lib/l10n/arb/app_en.arb index 323a98ad7..01b5c96ef 100644 --- a/lib/l10n/arb/app_en.arb +++ b/lib/l10n/arb/app_en.arb @@ -143,6 +143,9 @@ "noResult": "No result", "addCode": "Add code", "scanAQrCode": "Scan a QR code", - "enterDetailsManually": "Enter details manually" + "enterDetailsManually": "Enter details manually", + "edit": "Edit", + "copiedToClipboard": "Copied to clipboard", + "error": "Error" } diff --git a/lib/ui/code_widget.dart b/lib/ui/code_widget.dart index 0708cc08b..1e0c798c3 100644 --- a/lib/ui/code_widget.dart +++ b/lib/ui/code_widget.dart @@ -68,7 +68,7 @@ class _CodeWidgetState extends State { foregroundColor: Theme.of(context).colorScheme.inverseBackgroundColor, icon: Icons.edit_outlined, - label: 'Edit', + label: l10n.edit, padding: const EdgeInsets.only(left: 4, right: 0), spacing: 8, ), @@ -81,7 +81,7 @@ class _CodeWidgetState extends State { borderRadius: const BorderRadius.all(Radius.circular(12.0)), foregroundColor: const Color(0xFFFE4A49), icon: Icons.delete, - label: 'Delete', + label: l10n.delete, padding: const EdgeInsets.only(left: 0, right: 0), spacing: 8, ), @@ -212,9 +212,8 @@ class _CodeWidgetState extends State { } void _copyToClipboard() { - FlutterClipboard.copy(_getTotp()).then( - (value) => showToast(context, "Copied to clipboard"), - ); + FlutterClipboard.copy(_getTotp()) + .then((value) => showToast(context, context.l10n.copiedToClipboard)); } Future _onEditPressed(_) async { @@ -256,7 +255,7 @@ class _CodeWidgetState extends State { ), TextButton( child: Text( - "Cancel", + l10n.cancel, style: TextStyle( color: Theme.of(context).colorScheme.onSurface, ), @@ -291,7 +290,7 @@ class _CodeWidgetState extends State { try { return getTotp(widget.code); } catch (e) { - return "Error"; + return context.l10n.error; } } @@ -299,7 +298,7 @@ class _CodeWidgetState extends State { try { return getNextTotp(widget.code); } catch (e) { - return "Error"; + return context.l10n.error; } } }