FEATURE add translation

This commit is contained in:
konrad.lys@eu.equinix.com
2023-06-06 06:26:38 +02:00
parent bf0351f23f
commit fab33afc87
3 changed files with 21 additions and 10 deletions

View File

@@ -42,6 +42,8 @@ class ScannerPage extends StatefulWidget {
class _ScannerPageState extends State<ScannerPage>
with SingleTickerProviderStateMixin {
static const fkFileName = "filename";
final SliverOverlapAbsorberHandle searchBarHandle =
SliverOverlapAbsorberHandle();
final SliverOverlapAbsorberHandle actionsHandle =
@@ -147,7 +149,7 @@ class _ScannerPageState extends State<ScannerPage>
BlocBuilder<DocumentScannerCubit, List<File>>(
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<ScannerPage>
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<ScannerPage>
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<ScannerPage>
//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";

View File

@@ -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)"
}
}

View File

@@ -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)"
}
}