Skip to content

Commit 04d9535

Browse files
committed
Added translations for integer validator errorText
1 parent 36d1042 commit 04d9535

File tree

5 files changed

+20
-2
lines changed

5 files changed

+20
-2
lines changed

lib/l10n/intl_messages.arb

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"@@last_modified": "2020-10-08T17:47:59.750726",
2+
"@@last_modified": "2020-11-13T10:38:27.938366",
33
"requiredErrorText": "This field cannot be empty.",
44
"@requiredErrorText": {
55
"description": "Error Text for required validator",
@@ -70,6 +70,12 @@
7070
"type": "text",
7171
"placeholders": {}
7272
},
73+
"integerErrorText": "Value must be an integer.",
74+
"@integerErrorText": {
75+
"description": "Error Text for integer validator",
76+
"type": "text",
77+
"placeholders": {}
78+
},
7379
"creditCardErrorText": "This field requires a valid credit card number.",
7480
"@creditCardErrorText": {
7581
"description": "Error Text for credit card validator",

lib/l10n/messages_all.dart

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,18 +16,22 @@ import 'package:intl/message_lookup_by_library.dart';
1616
import 'package:intl/src/intl_helpers.dart';
1717

1818
import 'messages_en.dart' as messages_en;
19+
import 'messages_es.dart' as messages_es;
1920
import 'messages_messages.dart' as messages_messages;
2021

2122
typedef Future<dynamic> LibraryLoader();
2223
Map<String, LibraryLoader> _deferredLibraries = {
2324
'en': () => new Future.value(null),
25+
'es': () => new Future.value(null),
2426
'messages': () => new Future.value(null),
2527
};
2628

2729
MessageLookupByLibrary _findExact(String localeName) {
2830
switch (localeName) {
2931
case 'en':
3032
return messages_en.messages;
33+
case 'es':
34+
return messages_es.messages;
3135
case 'messages':
3236
return messages_messages.messages;
3337
default:

lib/l10n/messages_messages.dart

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ class MessageLookup extends MessageLookupByLibrary {
4040
"emailErrorText": MessageLookupByLibrary.simpleMessage(
4141
"This field requires a valid email address."),
4242
"equalErrorText": m4,
43+
"integerErrorText":
44+
MessageLookupByLibrary.simpleMessage("Value must be an integer."),
4345
"ipErrorText": MessageLookupByLibrary.simpleMessage(
4446
"This field requires a valid IP."),
4547
"matchErrorText": MessageLookupByLibrary.simpleMessage(

lib/localization/form_builder_localizations.dart

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,12 @@ class FormBuilderLocalizations {
9797
desc: 'Error Text for numeric validator',
9898
);
9999

100+
String get integerErrorText => Intl.message(
101+
'Value must be an integer.',
102+
name: 'integerErrorText',
103+
desc: 'Error Text for integer validator',
104+
);
105+
100106
String get creditCardErrorText => Intl.message(
101107
'This field requires a valid credit card number.',
102108
name: 'creditCardErrorText',

lib/src/form_builder_validators.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ class FormBuilderValidators {
192192
}) =>
193193
(valueCandidate) => true == valueCandidate?.isNotEmpty &&
194194
null == int.tryParse(valueCandidate, radix: radix)
195-
? errorText ?? FormBuilderLocalizations.of(context).numericErrorText
195+
? errorText ?? FormBuilderLocalizations.of(context).integerErrorText
196196
: null;
197197

198198
/// [FormFieldValidator] that requires the field's value to be a valid credit card number.

0 commit comments

Comments
 (0)