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(
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,

View File

@ -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;

View File

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

View File

@ -78,14 +78,14 @@ class _StockItemTestResultDisplayState extends RefreshableState<StockItemTestRes
},
fields: <Widget>[
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<StockItemTestRes
onSaved: (value) => _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<StockItemTestRes
buttons.add(SpeedDialChild(
child: Icon(FontAwesomeIcons.plusCircle),
label: "Add Test Result",
label: I18N.of(context).testResultAdd,
onTap: () {
addTestResult();
},