From fab33afc87df2c261b13c25ba87d45f6f44d77c9 Mon Sep 17 00:00:00 2001 From: "konrad.lys@eu.equinix.com" Date: Tue, 6 Jun 2023 06:26:38 +0200 Subject: [PATCH] FEATURE add translation --- .../document_scan/view/scanner_page.dart | 23 +++++++++++-------- lib/l10n/intl_en.arb | 4 ++++ lib/l10n/intl_pl.arb | 4 ++++ 3 files changed, 21 insertions(+), 10 deletions(-) diff --git a/lib/features/document_scan/view/scanner_page.dart b/lib/features/document_scan/view/scanner_page.dart index e58294b..e0d3ec2 100644 --- a/lib/features/document_scan/view/scanner_page.dart +++ b/lib/features/document_scan/view/scanner_page.dart @@ -42,6 +42,8 @@ class ScannerPage extends StatefulWidget { class _ScannerPageState extends State with SingleTickerProviderStateMixin { + static const fkFileName = "filename"; + final SliverOverlapAbsorberHandle searchBarHandle = SliverOverlapAbsorberHandle(); final SliverOverlapAbsorberHandle actionsHandle = @@ -147,7 +149,7 @@ class _ScannerPageState extends State BlocBuilder>( builder: (context, state) { return TextButton.icon( - label: Text("Export"), + label: Text(S.of(context)!.export), style: TextButton.styleFrom( padding: const EdgeInsets.fromLTRB(5, 10, 5, 10), ), @@ -172,9 +174,11 @@ class _ScannerPageState extends State autovalidateMode: AutovalidateMode.always, validator: (value) { - if (value == null || - value.isEmpty) { - return 'Please enter some text'; + if (value?.trim().isEmpty ?? + true) { + return S + .of(context)! + .thisFieldIsRequired; } return null; }, @@ -182,12 +186,11 @@ class _ScannerPageState extends State labelText: S.of(context)!.fileName, ), - initialValue: "test", - name: 'filename', + name: fkFileName, )), TextButton.icon( - label: const Text( - "Save a local copy"), + label: + Text(S.of(context)!.export), icon: const Icon(Icons.download), onPressed: () => { if (_downloadFormKey @@ -306,8 +309,8 @@ class _ScannerPageState extends State //TODO: Ask user to grant permissions } } - final name = (_downloadFormKey.currentState?.fields['filename']?.value ?? - "") as String; + final name = + _downloadFormKey.currentState?.fields[fkFileName]!.value as String; var fileName = "$name.pdf"; diff --git a/lib/l10n/intl_en.arb b/lib/l10n/intl_en.arb index dbf767f..9347625 100644 --- a/lib/l10n/intl_en.arb +++ b/lib/l10n/intl_en.arb @@ -811,5 +811,9 @@ "goToLogin": "Go to login", "@goToLogin": { "description": "Label of the button shown on the login page to skip logging in to existing accounts and navigate user to login page" + }, + "export": "Export", + "@export": { + "description": "Label for button that exports scanned images to pdf (before upload)" } } \ No newline at end of file diff --git a/lib/l10n/intl_pl.arb b/lib/l10n/intl_pl.arb index 8d9911b..f9b2801 100644 --- a/lib/l10n/intl_pl.arb +++ b/lib/l10n/intl_pl.arb @@ -811,5 +811,9 @@ "goToLogin": "Przejdź do logowania", "@goToLogin": { "description": "Label of the button shown on the login page to skip logging in to existing accounts and navigate user to login page" + }, + "export": "Eksport", + "@export": { + "description": "Label for button that exports scanned images to pdf (before upload)" } } \ No newline at end of file