diff --git a/lib/settings/login.dart b/lib/settings/login.dart index cac0dd9a..ff11b14b 100644 --- a/lib/settings/login.dart +++ b/lib/settings/login.dart @@ -94,14 +94,14 @@ class _InvenTreeLoginSettingsState extends State { ), StringField( label: I18N.of(context).username, - hint: "Enter username", + hint: I18N.of(context).enterPassword, initial: createNew ? '' : profile.username, onSaved: (value) => _username = value, validator: _validateUsername, ), StringField( label: I18N.of(context).password, - hint: "Enter password", + hint: I18N.of(context).enterUsername, initial: createNew ? '' : profile.password, onSaved: (value) => _password = value, validator: _validatePassword, diff --git a/lib/widget/fields.dart b/lib/widget/fields.dart index 3fa502b4..98aed1b4 100644 --- a/lib/widget/fields.dart +++ b/lib/widget/fields.dart @@ -3,6 +3,7 @@ import 'package:flutter/material.dart'; import 'package:font_awesome_flutter/font_awesome_flutter.dart'; import 'package:image_picker/image_picker.dart'; +import 'package:one_context/one_context.dart'; import 'package:flutter_gen/gen_l10n/app_localizations.dart'; import 'dart:async'; @@ -119,7 +120,7 @@ class StringField extends TextFormField { enabled: isEnabled, validator: (value) { if (!allowEmpty && value.isEmpty) { - return "Value cannot be empty"; + return I18N.of(OneContext().context).valueCannotBeEmpty; } if (validator != null) { @@ -146,12 +147,15 @@ class QuantityField extends TextFormField { controller: controller, keyboardType: TextInputType.numberWithOptions(signed: false, decimal: true), validator: (value) { - if (value.isEmpty) return "Quantity is empty"; + + final ctx = OneContext().context; + + if (value.isEmpty) return I18N.of(ctx).quantityEmpty; double quantity = double.tryParse(value); - if (quantity == null) return "Invalid quantity"; - if (quantity <= 0) return "Quantity must be positive"; + if (quantity == null) return I18N.of(ctx).quantityInvalid; + if (quantity <= 0) return I18N.of(ctx).quantityPositive; if ((max != null) && (quantity > max)) return "Quantity must not exceed ${max}"; return null; diff --git a/lib/widget/stock_detail.dart b/lib/widget/stock_detail.dart index 8cddbe38..07c7e278 100644 --- a/lib/widget/stock_detail.dart +++ b/lib/widget/stock_detail.dart @@ -304,7 +304,7 @@ class _StockItemDisplayState extends RefreshableState { }, validator: (value) { if (selectedLocation == null) { - return "Select a location"; + return I18N.of(context).selectLocation; } return null; diff --git a/lib/widget/stock_item_test_results.dart b/lib/widget/stock_item_test_results.dart index dc2fd7ae..6baba8ad 100644 --- a/lib/widget/stock_item_test_results.dart +++ b/lib/widget/stock_item_test_results.dart @@ -78,14 +78,14 @@ class _StockItemTestResultDisplayState extends RefreshableState[ StringField( - label: "Test Name", + label: I18N.of(context).testName, initial: name, isEnabled: nameIsEditable, onSaved: (value) => _name = value, ), CheckBoxField( label: I18N.of(context).result, - hint: "Test passed or failed", + hint: I18N.of(context).testPassedOrFailed, initial: true, onSaved: (value) => _result = value, ), @@ -96,14 +96,14 @@ class _StockItemTestResultDisplayState extends RefreshableState _value = value, validator: (String value) { if (valueRequired && (value == null || value.isEmpty)) { - return "Value required for this test"; + return I18N.of(context).valueRequired; } return null; }, ), ImagePickerField( context, - label: "Attach Image", + label: I18N.of(context).attachImage, required: attachmentRequired, onSaved: (attachment) => _attachment = attachment, ), @@ -279,7 +279,7 @@ class _StockItemTestResultDisplayState extends RefreshableState