Skip to content

Commit adf5e71

Browse files
Merge pull request #1067 from danvick/improve-validator-docs
Improve validator docs
2 parents b6c54f8 + 5bb3765 commit adf5e71

File tree

14 files changed

+46
-20
lines changed

14 files changed

+46
-20
lines changed

packages/form_builder_validators/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ Available built-in validators include:
6262
* `FormBuilderValidators.maxLength()` - requires the length of the field's value to be less than or equal to the provided maximum length.
6363
* `FormBuilderValidators.min()` - requires the field's value to be greater than or equal to the provided number.
6464
* `FormBuilderValidators.minLength()` - requires the length of the field's value to be greater than or equal to the provided minimum length.
65+
* ``FormBuilderValidators.equalLength()`` - requires the length of the field's value to be equal to the provided minimum length.
6566
* `FormBuilderValidators.numeric()` - requires the field's value to be a valid number.
6667
* `FormBuilderValidators.required()` - requires the field have a non-empty value.
6768
* ``FormBuilderValidators.url()`` - requires the field's value to be a valid url.
@@ -145,6 +146,7 @@ To allow for localization of default error messages within your app, add `FormBu
145146
- Spanish (es)
146147
- Swahili (sw)
147148
- Ukrainian (uk)
149+
- Turkish (tr)
148150

149151
And you can still add your custom error messages.
150152

packages/form_builder_validators/lib/l10n/intl_en.arb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@
3939
"maxLength": {}
4040
}
4141
},
42-
"lengthEqualErrorText": "Value must have a length equal to {length}",
43-
"@lengthEqualErrorText": {
42+
"equalLengthErrorText": "Value must have a length equal to {length}",
43+
"@equalLengthErrorText": {
4444
"description": "Error Text for required field",
4545
"type": "text",
4646
"placeholders": {

packages/form_builder_validators/lib/l10n/intl_es.arb

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,14 @@
3939
"maxLength": {}
4040
}
4141
},
42+
"equalLengthErrorText": "El valor debe tener una longitud igual a {length}",
43+
"@equalLengthErrorText": {
44+
"description": "Error Text for required field",
45+
"type": "text",
46+
"placeholders": {
47+
"length": {}
48+
}
49+
},
4250
"emailErrorText": "Este campo requiere una dirección de correo electrónico válida.",
4351
"@emailErrorText": {
4452
"description": "Error Text for email field",

packages/form_builder_validators/lib/l10n/intl_messages.arb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,8 @@
5454
"maxLength": {}
5555
}
5656
},
57-
"lengthEqualErrorText": "Value must have a length equal to {length}",
58-
"@lengthEqualErrorText": {
57+
"equalLengthErrorText": "Value must have a length equal to {length}",
58+
"@equalLengthErrorText": {
5959
"description": "Error Text for required field",
6060
"type": "text",
6161
"placeholders": {

packages/form_builder_validators/lib/l10n/intl_pt.arb

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,14 @@
3939
"maxLength": {}
4040
}
4141
},
42+
"equalLengthErrorText": "O valor deve ter um comprimento igual a {length}",
43+
"@equalLengthErrorText": {
44+
"description": "Error Text for required field",
45+
"type": "text",
46+
"placeholders": {
47+
"length": {}
48+
}
49+
},
4250
"emailErrorText": "Este campo requer um endereço de e-mail válido.",
4351
"@emailErrorText": {
4452
"description": "Error Text for email field",

packages/form_builder_validators/lib/l10n/intl_tr.arb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@
3939
"maxLength": {}
4040
}
4141
},
42-
"lengthEqualErrorText": "Değerin uzunluğu {length} değerine eşit olmalıdır.",
43-
"@lengthEqualErrorText": {
42+
"equalLengthErrorText": "Değerin uzunluğu {length} değerine eşit olmalıdır.",
43+
"@equalLengthErrorText": {
4444
"description": "Error Text for required field",
4545
"type": "text",
4646
"placeholders": {

packages/form_builder_validators/lib/localization/intl/messages_en.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,11 @@ class MessageLookup extends MessageLookupByLibrary {
4545
"emailErrorText": MessageLookupByLibrary.simpleMessage(
4646
"This field requires a valid email address."),
4747
"equalErrorText": m0,
48+
"equalLengthErrorText": m6,
4849
"integerErrorText": MessageLookupByLibrary.simpleMessage(
4950
"This field requires a valid integer."),
5051
"ipErrorText": MessageLookupByLibrary.simpleMessage(
5152
"This field requires a valid IP."),
52-
"lengthEqualErrorText": m6,
5353
"matchErrorText": MessageLookupByLibrary.simpleMessage(
5454
"Value does not match pattern."),
5555
"maxErrorText": m1,

packages/form_builder_validators/lib/localization/intl/messages_es.dart

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@ typedef String MessageIfAbsent(String messageStr, List<dynamic> args);
2020
class MessageLookup extends MessageLookupByLibrary {
2121
String get localeName => 'es';
2222

23+
static String m6(length) =>
24+
"El valor debe tener una longitud igual a ${length}";
25+
2326
static String m1(max) => "El valor debe ser menor o igual que ${max}.";
2427

2528
static String m2(maxLength) =>
@@ -38,6 +41,7 @@ class MessageLookup extends MessageLookupByLibrary {
3841
"Este campo requiere una cadena de fecha válida."),
3942
"emailErrorText": MessageLookupByLibrary.simpleMessage(
4043
"Este campo requiere una dirección de correo electrónico válida."),
44+
"equalLengthErrorText": m6,
4145
"ipErrorText": MessageLookupByLibrary.simpleMessage(
4246
"Este campo requiere una IP válida."),
4347
"matchErrorText": MessageLookupByLibrary.simpleMessage(

packages/form_builder_validators/lib/localization/intl/messages_messages.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,11 @@ class MessageLookup extends MessageLookupByLibrary {
4545
"emailErrorText": MessageLookupByLibrary.simpleMessage(
4646
"This field requires a valid email address."),
4747
"equalErrorText": m0,
48+
"equalLengthErrorText": m6,
4849
"integerErrorText":
4950
MessageLookupByLibrary.simpleMessage("Value must be an integer."),
5051
"ipErrorText": MessageLookupByLibrary.simpleMessage(
5152
"This field requires a valid IP."),
52-
"lengthEqualErrorText": m6,
5353
"matchErrorText": MessageLookupByLibrary.simpleMessage(
5454
"Value does not match pattern."),
5555
"maxErrorText": m1,

packages/form_builder_validators/lib/localization/intl/messages_pt.dart

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@ typedef String MessageIfAbsent(String messageStr, List<dynamic> args);
2020
class MessageLookup extends MessageLookupByLibrary {
2121
String get localeName => 'pt';
2222

23+
static String m6(length) =>
24+
"O valor deve ter um comprimento igual a ${length}";
25+
2326
static String m1(max) => "O valor deve ser menor ou igual a ${max}";
2427

2528
static String m2(maxLength) =>
@@ -38,6 +41,7 @@ class MessageLookup extends MessageLookupByLibrary {
3841
"Este campo requer uma string de data válida."),
3942
"emailErrorText": MessageLookupByLibrary.simpleMessage(
4043
"Este campo requer um endereço de e-mail válido."),
44+
"equalLengthErrorText": m6,
4145
"ipErrorText": MessageLookupByLibrary.simpleMessage(
4246
"Este campo requer um IP válido."),
4347
"matchErrorText": MessageLookupByLibrary.simpleMessage(

0 commit comments

Comments
 (0)