Skip to content

Commit b9f372c

Browse files
Merge pull request #29 from moazelsawaf/main
New validators for `minWordsCount` & `maxWordsCount` 💙
2 parents 9bdda52 + 6457bba commit b9f372c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

68 files changed

+526
-4
lines changed

README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ Also included is the `l10n` / `i18n` of error text messages to multiple language
4040
## Validators
4141

4242
This package comes with several most common `FormFieldValidator`s such as required, numeric, mail,
43-
URL, min, max, minLength, maxLength, IP, credit card, etc., with default `errorText` messages.
43+
URL, min, max, minLength, maxLength, minWordsCount, maxWordsCount, IP, credit card, etc., with default `errorText` messages.
4444

4545
Available built-in validators include:
4646

@@ -53,8 +53,10 @@ Available built-in validators include:
5353
- `FormBuilderValidators.match()` - requires the field's value to match the provided regex pattern.
5454
- `FormBuilderValidators.max()` - requires the field's value to be less than or equal to the provided number.
5555
- `FormBuilderValidators.maxLength()` - requires the length of the field's value to be less than or equal to the provided maximum length.
56+
- `FormBuilderValidators.maxWordsCount()` - requires the words count of the field's value to be less than or equal to the provided maximum count.
5657
- `FormBuilderValidators.min()` - requires the field's value to be greater than or equal to the provided number.
5758
- `FormBuilderValidators.minLength()` - requires the length of the field's value to be greater than or equal to the provided minimum length.
59+
- `FormBuilderValidators.minWordsCount()` - requires the words count of the field's value to be greater than or equal to the provided minimum count.
5860
- `FormBuilderValidators.equalLength()` - requires the length of the field's value to be equal to the provided minimum length.
5961
- `FormBuilderValidators.numeric()` - requires the field's value to be a valid number.
6062
- `FormBuilderValidators.required()` - requires the field have a non-empty value.
@@ -196,7 +198,7 @@ See [contribution file](https://github.com/flutter-form-builder-ecosystem/.githu
196198

197199
We especially welcome efforts to internationalize/localize the package by translating the default validation `errorText` strings for built-in validation rules.
198200

199-
1. Add ARB files
201+
1. Add ARB files
200202

201203
Create one ARB file inside the `lib/l10n` folder for each of the locales you need to add support. Name the files in the following way: `intl_<LOCALE_ISO_CODE>.arb`. For example: `intl_fr.arb` or `intl_fr_FR.arb`.
202204

lib/l10n/intl_ar.arb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
"minLengthErrorText": "يجب أن لا يقل طول القيمة المدخلة عن {minLength}.",
88
"maxErrorText": "يجب أن لا تزيد القيمة المدخلة عن {max}.",
99
"maxLengthErrorText": "يجب أن لا يزيد طول القيمة المدخلة عن {maxLength}.",
10+
"minWordsCountErrorText": "يجب أن لا يقل عدد الكلمات المدخلة عن {minWordsCount}.",
11+
"maxWordsCountErrorText": "يجب أن لا يزيد عدد الكلمات المدخلة عن {maxWordsCount}.",
1012
"emailErrorText": "هذا الحقل يتطلب عنوان بريد إلكتروني صالح.",
1113
"urlErrorText": "هذا الحقل يتطلب عنوان URL صالح.",
1214
"matchErrorText": "القيمة المدخلة لا تطابق الصيغة المطلوبة.",

lib/l10n/intl_bn.arb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
"minLengthErrorText": "মান অবশ্যই {minLength} এর চেয়ে বেশি বা সমান সংখ্যা হতে হবে।",
88
"maxErrorText": "মান অবশ্যই {max} এর কম বা সমান হতে হবে।",
99
"maxLengthErrorText": "মান অবশ্যই {maxLength} এর থেকে কম বা সমান সংখ্যা হতে হবে।",
10+
"minWordsCountErrorText": "মান অবশ্যই একটি শব্দের গণনা থাকতে হবে {minWordsCount} এর চেয়ে বেশি বা সমান",
11+
"maxWordsCountErrorText": "মান অবশ্যই একটি শব্দের গণনা থাকতে হবে {maxWordsCount} এর চেয়ে কম বা সমান",
1012
"emailErrorText": "একটি বৈধ ইমেল আইডি প্রয়োজন।",
1113
"urlErrorText": "একটি বৈধ ওয়েব এড্রেস প্রয়োজন।",
1214
"matchErrorText": "মান প্যাটার্নের সাথে মেলে না।",

lib/l10n/intl_bs.arb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
"notEqualErrorText": "Vrijednost ne smije biti jednaka {value}.",
66
"minErrorText": "Vrijednost mora biti veća ili jednaka {min}.",
77
"minLengthErrorText": "Vrijednost mora biti duža ili jednaka {minLength} znakova.",
8+
"minWordsCountErrorText": "Vrijednost mora imati riječi računanje veće ili jednake {minWordsCount}",
9+
"maxWordsCountErrorText": "Vrijednost mora imati riječi koje računaju manje ili jednake {maxWordsCount}",
810
"maxErrorText": "Vrijednost mora biti manja ili jednaka {max}",
911
"maxLengthErrorText": "Vrijednost mora biti kraća ili jednaka {maxLength} znakova.",
1012
"equalLengthErrorText": "Vrijednost mora biti duga {length} znakova.",

lib/l10n/intl_ca.arb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,10 @@
33
"requiredErrorText": "Aquest camp no pot estar buit.",
44
"minErrorText": "El valor ha de ser superior o igual a {min}.",
55
"minLengthErrorText": "El valor ha de tenir una longitud superior o igual a {minLength}",
6+
"minWordsCountErrorText": "El valor ha de tenir un compte de paraules superior o igual a {minWordsCount}",
67
"maxErrorText": "El valor ha de ser inferior o igual a {max}",
78
"maxLengthErrorText": "El valor ha de tenir una longitud inferior o igual a {maxLength}",
9+
"maxWordsCountErrorText": "El valor ha de tenir un compte de paraules inferior o igual a {maxWordsCount}",
810
"emailErrorText": "Aquest camp requereix una adreça de correu electrònic vàlida.",
911
"integerErrorText": "Aquest camp requereix un nombre enter vàlid.",
1012
"equalErrorText": "Aquest valor de camp ha de ser igual a {value}.",

lib/l10n/intl_cs.arb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
"minLengthErrorText": "Hodnota musí mít délku větší než nebo rovnu {minLength}",
66
"maxErrorText": "Hodnota musí být menší než nebo rovna {max}.",
77
"maxLengthErrorText": "Hodnota musí mít délku menší než nebo rovnu {maxLength}.",
8+
"minWordsCountErrorText": "Hodnota musí mít počet slov větší nebo rovná {minWordsCount}",
9+
"maxWordsCountErrorText": "Hodnota musí mít počet slov menší nebo rovná {maxWordsCount}",
810
"equalLengthErrorText": "Hodnota musí mít délku rovnu {length}",
911
"emailErrorText": "Pole vyžaduje platnou e-mailovou adresu.",
1012
"integerErrorText": "Hodnota musí být celé číslo.",

lib/l10n/intl_de.arb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
"minLengthErrorText": "Der Wert muss eine Länge größer als oder gleich {minLength} haben.",
77
"maxErrorText": "Der Wert muss kleiner als oder gleich {max} sein.",
88
"maxLengthErrorText": "Der Wert muss eine Länge kleiner als oder gleich {maxLength} haben.",
9+
"minWordsCountErrorText": "Der Wert muss eine Wörter haben, die größer oder gleich {minWordsCount} ist",
10+
"maxWordsCountErrorText": "Der Wert muss eine Wörter weniger als oder gleich {maxWordsCount} zählen lassen",
911
"emailErrorText": "Für dieses Feld ist eine gültige E-Mail-Adresse erforderlich.",
1012
"urlErrorText": "Für dieses Feld ist eine gültige URL-Adresse erforderlich.",
1113
"matchErrorText": "Der Wert stimmt nicht mit dem Muster überein.",

lib/l10n/intl_en.arb

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,14 @@
2323
"minLength": {}
2424
}
2525
},
26+
"minWordsCountErrorText": "Value must have a words count greater than or equal to {minWordsCount}",
27+
"@minWordsCountErrorText": {
28+
"description": "Error Text for required field",
29+
"type": "text",
30+
"placeholders": {
31+
"minWordsCount": {}
32+
}
33+
},
2634
"maxErrorText": "Value must be less than or equal to {max}",
2735
"@maxErrorText": {
2836
"description": "Error Text for required field",
@@ -39,6 +47,14 @@
3947
"maxLength": {}
4048
}
4149
},
50+
"maxWordsCountErrorText": "Value must have a words count less than or equal to {maxWordsCount}",
51+
"@maxWordsCountErrorText": {
52+
"description": "Error Text for required field",
53+
"type": "text",
54+
"placeholders": {
55+
"maxWordsCount": {}
56+
}
57+
},
4258
"equalLengthErrorText": "Value must have a length equal to {length}",
4359
"@equalLengthErrorText": {
4460
"description": "Error Text for required field",

lib/l10n/intl_es.arb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
"minLengthErrorText": "El valor debe tener una longitud mayor o igual a {minLength}",
66
"maxErrorText": "El valor debe ser menor o igual que {max}.",
77
"maxLengthErrorText": "El valor debe tener una longitud menor o igual a {maxLength}",
8+
"minWordsCountErrorText": "El valor debe tener un recuento de palabras mayor o igual a {minWordsCount}",
9+
"maxWordsCountErrorText": "El valor debe tener un recuento de palabras menos o igual a {maxWordsCount}",
810
"equalLengthErrorText": "El valor debe tener una longitud igual a {length}",
911
"emailErrorText": "Este campo requiere una dirección de correo electrónico válida.",
1012
"urlErrorText": "Este campo requiere una dirección URL válida.",

lib/l10n/intl_et.arb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77
"minLengthErrorText": "Sisendi pikkus peab olema vähemalt {minLength}",
88
"maxErrorText": "Väärtus ei tohi olla üle {max}",
99
"maxLengthErrorText": "Sisendi pikkus ei tohi olla üle {maxLength}",
10-
"emailErrorText": "Sellele väljale tuleb sisestada korrektne meiliaadress.",
10+
"minWordsCountErrorText": "Väärtuse sõnade arv peab olema suurem kui {minWordsCount}",
11+
"maxWordsCountErrorText": "Väärtuses peab olema sõnade arv vähem või võrdne {maxWordsCount}",
1112
"urlErrorText": "Sellele väljale tuleb sisestada korrektne URL.",
1213
"matchErrorText": "Sisend ei vasta mustrile.",
1314
"numericErrorText": "Sisend peab olema arv.",

0 commit comments

Comments
 (0)