2
0
mirror of https://github.com/inventree/inventree-app.git synced 2025-04-28 13:36:50 +00:00

More translations

This commit is contained in:
Oliver Walters 2021-05-19 23:15:49 +10:00
parent 34a6a43d35
commit b86025013d
4 changed files with 16 additions and 12 deletions

View File

@ -94,14 +94,14 @@ class _InvenTreeLoginSettingsState extends State<InvenTreeLoginSettingsWidget> {
), ),
StringField( StringField(
label: I18N.of(context).username, label: I18N.of(context).username,
hint: "Enter username", hint: I18N.of(context).enterPassword,
initial: createNew ? '' : profile.username, initial: createNew ? '' : profile.username,
onSaved: (value) => _username = value, onSaved: (value) => _username = value,
validator: _validateUsername, validator: _validateUsername,
), ),
StringField( StringField(
label: I18N.of(context).password, label: I18N.of(context).password,
hint: "Enter password", hint: I18N.of(context).enterUsername,
initial: createNew ? '' : profile.password, initial: createNew ? '' : profile.password,
onSaved: (value) => _password = value, onSaved: (value) => _password = value,
validator: _validatePassword, validator: _validatePassword,

View File

@ -3,6 +3,7 @@ import 'package:flutter/material.dart';
import 'package:font_awesome_flutter/font_awesome_flutter.dart'; import 'package:font_awesome_flutter/font_awesome_flutter.dart';
import 'package:image_picker/image_picker.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 'package:flutter_gen/gen_l10n/app_localizations.dart';
import 'dart:async'; import 'dart:async';
@ -119,7 +120,7 @@ class StringField extends TextFormField {
enabled: isEnabled, enabled: isEnabled,
validator: (value) { validator: (value) {
if (!allowEmpty && value.isEmpty) { if (!allowEmpty && value.isEmpty) {
return "Value cannot be empty"; return I18N.of(OneContext().context).valueCannotBeEmpty;
} }
if (validator != null) { if (validator != null) {
@ -146,12 +147,15 @@ class QuantityField extends TextFormField {
controller: controller, controller: controller,
keyboardType: TextInputType.numberWithOptions(signed: false, decimal: true), keyboardType: TextInputType.numberWithOptions(signed: false, decimal: true),
validator: (value) { 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); double quantity = double.tryParse(value);
if (quantity == null) return "Invalid quantity"; if (quantity == null) return I18N.of(ctx).quantityInvalid;
if (quantity <= 0) return "Quantity must be positive"; if (quantity <= 0) return I18N.of(ctx).quantityPositive;
if ((max != null) && (quantity > max)) return "Quantity must not exceed ${max}"; if ((max != null) && (quantity > max)) return "Quantity must not exceed ${max}";
return null; return null;

View File

@ -304,7 +304,7 @@ class _StockItemDisplayState extends RefreshableState<StockDetailWidget> {
}, },
validator: (value) { validator: (value) {
if (selectedLocation == null) { if (selectedLocation == null) {
return "Select a location"; return I18N.of(context).selectLocation;
} }
return null; return null;

View File

@ -78,14 +78,14 @@ class _StockItemTestResultDisplayState extends RefreshableState<StockItemTestRes
}, },
fields: <Widget>[ fields: <Widget>[
StringField( StringField(
label: "Test Name", label: I18N.of(context).testName,
initial: name, initial: name,
isEnabled: nameIsEditable, isEnabled: nameIsEditable,
onSaved: (value) => _name = value, onSaved: (value) => _name = value,
), ),
CheckBoxField( CheckBoxField(
label: I18N.of(context).result, label: I18N.of(context).result,
hint: "Test passed or failed", hint: I18N.of(context).testPassedOrFailed,
initial: true, initial: true,
onSaved: (value) => _result = value, onSaved: (value) => _result = value,
), ),
@ -96,14 +96,14 @@ class _StockItemTestResultDisplayState extends RefreshableState<StockItemTestRes
onSaved: (value) => _value = value, onSaved: (value) => _value = value,
validator: (String value) { validator: (String value) {
if (valueRequired && (value == null || value.isEmpty)) { if (valueRequired && (value == null || value.isEmpty)) {
return "Value required for this test"; return I18N.of(context).valueRequired;
} }
return null; return null;
}, },
), ),
ImagePickerField( ImagePickerField(
context, context,
label: "Attach Image", label: I18N.of(context).attachImage,
required: attachmentRequired, required: attachmentRequired,
onSaved: (attachment) => _attachment = attachment, onSaved: (attachment) => _attachment = attachment,
), ),
@ -279,7 +279,7 @@ class _StockItemTestResultDisplayState extends RefreshableState<StockItemTestRes
buttons.add(SpeedDialChild( buttons.add(SpeedDialChild(
child: Icon(FontAwesomeIcons.plusCircle), child: Icon(FontAwesomeIcons.plusCircle),
label: "Add Test Result", label: I18N.of(context).testResultAdd,
onTap: () { onTap: () {
addTestResult(); addTestResult();
}, },