From 96ba41474f24ed042ce336f9370cc85745cf4e18 Mon Sep 17 00:00:00 2001 From: Oliver Walters Date: Wed, 19 May 2021 22:35:29 +1000 Subject: [PATCH] Fix references for showServerError --- lib/api.dart | 14 +++++++------- lib/barcode.dart | 7 +++++-- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/lib/api.dart b/lib/api.dart index 10396bfa..a2371014 100644 --- a/lib/api.dart +++ b/lib/api.dart @@ -227,8 +227,8 @@ class InvenTreeAPI { if (data == null || !data.containsKey("server") || !data.containsKey("version") || !data.containsKey("instance")) { showServerError( - "Missing Data", - "Server response missing required fields" + I18N.of(ctx).missingData, + I18N.of(ctx).serverMissingData, ); return false; @@ -283,7 +283,7 @@ class InvenTreeAPI { case 403: showServerError( I18N.of(ctx).serverAuthenticationError, - "Incorrect username:password combination" + I18N.of(ctx).invalidUsernamePassword, ); break; default: @@ -299,7 +299,7 @@ class InvenTreeAPI { if (data == null || !data.containsKey("token")) { showServerError( I18N.of(OneContext().context).tokenMissing, - "Access token missing from response" + I18N.of(OneContext().context).tokenMissingFromResponse, ); return false; @@ -644,7 +644,7 @@ class InvenTreeAPI { } else { showServerError( I18N.of(OneContext().context).serverCertificateError, - "Server HTTPS certificate invalid" + I18N.of(OneContext().context).serverCertificateInvalid, ); return false; } @@ -766,8 +766,8 @@ class InvenTreeAPI { print("${body}"); showServerError( - "Format Exception", - "JSON data format exception:\n${body}" + I18N.of(OneContext().context).formatException, + I18N.of(OneContext().context).formatExceptionJson + ":\n${body}" ); return null; } diff --git a/lib/barcode.dart b/lib/barcode.dart index 6680bc7e..0e5c73ea 100644 --- a/lib/barcode.dart +++ b/lib/barcode.dart @@ -227,7 +227,7 @@ class BarcodeScanHandler extends BarcodeHandler { title: Text(I18N.of(_context).unknownResponse), children: [ ListTile( - title: Text("Response data"), + title: Text(I18N.of(_context).responseData), subtitle: Text(data.toString()), ) ], @@ -270,7 +270,10 @@ class StockItemBarcodeAssignmentHandler extends BarcodeHandler { // If the barcode is unknown, we *can* assign it to the stock item! if (!data.containsKey("hash")) { - showServerError("Missing data", "Barcode hash data missing from response"); + showServerError( + I18N.of(_context).missingData, + I18N.of(_context).barcodeMissingHash, + ); } else { // Send the 'hash' code as the UID for the stock item