Skip to content

Commit 6eae9fe

Browse files
Merge pull request #13 from azmilazizi/ms-localization
added support for Malay (ms) localization
2 parents 1c2b708 + bf5376b commit 6eae9fe

File tree

7 files changed

+249
-72
lines changed

7 files changed

+249
-72
lines changed

README.md

Lines changed: 36 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -10,27 +10,27 @@ Also included is the `l10n` / `i18n` of error text messages to multiple language
1010
[![CodeFactor Grade](https://img.shields.io/codefactor/grade/github/flutter-form-builder-ecosystem/form_builder_validators?logo=codefactor&style=for-the-badge)](https://www.codefactor.io/repository/github/flutter-form-builder-ecosystem/form_builder_validators)
1111
[![Discord](https://img.shields.io/discord/985922433578053673?logo=discord&style=for-the-badge)](https://discord.com/invite/25KNPMJQf2)
1212

13-
___
13+
---
1414

1515
> ### Migrating from version 7 to 8
16+
>
1617
> To migrate from v7 to v8, remove `context` as a parameter to validator functions. For example, `FormBuilderValidators.required(context)` becomes `FormBuilderValidators.required()` without context passed to it.
1718
1819
- [Features](#features)
1920
- [Validators](#validators)
2021
- [Supported languages](#supported-languages)
2122
- [Use](#use)
22-
- [Setup](#setup)
23-
- [Basic use](#basic-use)
24-
- [Especific uses](#especific-uses)
23+
- [Setup](#setup)
24+
- [Basic use](#basic-use)
25+
- [Especific uses](#especific-uses)
2526
- [Support](#support)
26-
- [Contribute](#contribute)
27-
- [Questions and answers](#questions-and-answers)
28-
- [Donations](#donations)
27+
- [Contribute](#contribute)
28+
- [Questions and answers](#questions-and-answers)
29+
- [Donations](#donations)
2930
- [Roadmap](#roadmap)
3031
- [Ecosystem](#ecosystem)
3132
- [Thanks to](#thanks-to)
32-
- [Contributors](#contributors)
33-
33+
- [Contributors](#contributors)
3434

3535
## Features
3636

@@ -43,23 +43,24 @@ This package comes with several most common `FormFieldValidator`s such as requir
4343
URL, min, max, minLength, maxLength, IP, credit card, etc., with default `errorText` messages.
4444

4545
Available built-in validators include:
46-
* `FormBuilderValidators.creditCard()` - requires the field's value to be a valid credit card number.
47-
* `FormBuilderValidators.date()` - requires the field's value to be a valid date string.
48-
* `FormBuilderValidators.email()` - requires the field's value to be a valid email address.
49-
* `FormBuilderValidators.equal()` - requires the field's value be equal to provided object.
50-
* `FormBuilderValidators.integer()` - requires the field's value to be an integer.
51-
* `FormBuilderValidators.ip()` - requires the field's value to be a valid IP address.
52-
* `FormBuilderValidators.match()` - requires the field's value to match the provided regex pattern.
53-
* `FormBuilderValidators.max()` - requires the field's value to be less than or equal to the provided number.
54-
* `FormBuilderValidators.maxLength()` - requires the length of the field's value to be less than or equal to the provided maximum length.
55-
* `FormBuilderValidators.min()` - requires the field's value to be greater than or equal to the provided number.
56-
* `FormBuilderValidators.minLength()` - requires the length of the field's value to be greater than or equal to the provided minimum length.
57-
* `FormBuilderValidators.equalLength()` - requires the length of the field's value to be equal to the provided minimum length.
58-
* `FormBuilderValidators.numeric()` - requires the field's value to be a valid number.
59-
* `FormBuilderValidators.required()` - requires the field have a non-empty value.
60-
* `FormBuilderValidators.url()` - requires the field's value to be a valid url.
61-
62-
### Supported languages
46+
47+
- `FormBuilderValidators.creditCard()` - requires the field's value to be a valid credit card number.
48+
- `FormBuilderValidators.date()` - requires the field's value to be a valid date string.
49+
- `FormBuilderValidators.email()` - requires the field's value to be a valid email address.
50+
- `FormBuilderValidators.equal()` - requires the field's value be equal to provided object.
51+
- `FormBuilderValidators.integer()` - requires the field's value to be an integer.
52+
- `FormBuilderValidators.ip()` - requires the field's value to be a valid IP address.
53+
- `FormBuilderValidators.match()` - requires the field's value to match the provided regex pattern.
54+
- `FormBuilderValidators.max()` - requires the field's value to be less than or equal to the provided number.
55+
- `FormBuilderValidators.maxLength()` - requires the length of the field's value to be less than or equal to the provided maximum length.
56+
- `FormBuilderValidators.min()` - requires the field's value to be greater than or equal to the provided number.
57+
- `FormBuilderValidators.minLength()` - requires the length of the field's value to be greater than or equal to the provided minimum length.
58+
- `FormBuilderValidators.equalLength()` - requires the length of the field's value to be equal to the provided minimum length.
59+
- `FormBuilderValidators.numeric()` - requires the field's value to be a valid number.
60+
- `FormBuilderValidators.required()` - requires the field have a non-empty value.
61+
- `FormBuilderValidators.url()` - requires the field's value to be a valid url.
62+
63+
### Supported languages
6364

6465
Validators support default errorText messages in this languages:
6566

@@ -93,6 +94,7 @@ Validators support default errorText messages in this languages:
9394
- Swahili (sw)
9495
- Ukrainian (uk)
9596
- Turkish (tr)
97+
- Malay (ms)
9698

9799
And you can still add your custom error messages.
98100

@@ -140,6 +142,7 @@ See [pud.dev example tab](https://pub.dev/packages/form_builder_validators/examp
140142
On validation, each validator is run, and if any one validator returns a non-null value (i.e., a String), validation fails, and the `errorText` for the field is set as the returned string.
141143

142144
Example:
145+
143146
```dart
144147
TextFormField(
145148
decoration: InputDecoration(labelText: 'Age'),
@@ -173,17 +176,17 @@ TextFormField(
173176

174177
You have some ways to contribute to this packages
175178

176-
- Beginner: Reporting bugs or request new features
177-
- Intermediate: Implement new features (from issues or not) and created pull requests
178-
- Advanced: Join to [organization](#ecosystem) like a member and help coding, manage issues, dicuss new features and other things
179+
- Beginner: Reporting bugs or request new features
180+
- Intermediate: Implement new features (from issues or not) and created pull requests
181+
- Advanced: Join to [organization](#ecosystem) like a member and help coding, manage issues, dicuss new features and other things
179182

180-
See [contribution file](https://github.com/flutter-form-builder-ecosystem/.github/blob/main/CONTRIBUTING.md) for more details
183+
See [contribution file](https://github.com/flutter-form-builder-ecosystem/.github/blob/main/CONTRIBUTING.md) for more details
181184

182-
#### Add new supported language
185+
#### Add new supported language
183186

184-
We especially welcome efforts to internationalize/localize the package by translating the default validation `errorText` strings for built-in validation rules.
187+
We especially welcome efforts to internationalize/localize the package by translating the default validation `errorText` strings for built-in validation rules.
185188

186-
1. Add ARB files
189+
1. Add ARB files
187190

188191
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`.
189192

@@ -221,7 +224,6 @@ Buy a coffe to [Danvick Miller](https://twitter.com/danvickmiller), creator of t
221224

222225
- [Solve open issues](https://github.com/flutter-form-builder-ecosystem/form_builder_validators/issues), [prioritizing bugs](https://github.com/flutter-form-builder-ecosystem/form_builder_validators/labels/bug)
223226

224-
225227
## Ecosystem
226228

227229
Take a look to [our awesome ecosystem](https://github.com/flutter-form-builder-ecosystem) and all packages in there

example/pubspec.lock

Lines changed: 12 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ packages:
77
name: async
88
url: "https://pub.dartlang.org"
99
source: hosted
10-
version: "2.8.2"
10+
version: "2.9.0"
1111
boolean_selector:
1212
dependency: transitive
1313
description:
@@ -21,21 +21,14 @@ packages:
2121
name: characters
2222
url: "https://pub.dartlang.org"
2323
source: hosted
24-
version: "1.2.0"
25-
charcode:
26-
dependency: transitive
27-
description:
28-
name: charcode
29-
url: "https://pub.dartlang.org"
30-
source: hosted
31-
version: "1.3.1"
24+
version: "1.2.1"
3225
clock:
3326
dependency: transitive
3427
description:
3528
name: clock
3629
url: "https://pub.dartlang.org"
3730
source: hosted
38-
version: "1.1.0"
31+
version: "1.1.1"
3932
collection:
4033
dependency: transitive
4134
description:
@@ -49,7 +42,7 @@ packages:
4942
name: fake_async
5043
url: "https://pub.dartlang.org"
5144
source: hosted
52-
version: "1.3.0"
45+
version: "1.3.1"
5346
flutter:
5447
dependency: "direct main"
5548
description: flutter
@@ -99,28 +92,28 @@ packages:
9992
name: matcher
10093
url: "https://pub.dartlang.org"
10194
source: hosted
102-
version: "0.12.11"
95+
version: "0.12.12"
10396
material_color_utilities:
10497
dependency: transitive
10598
description:
10699
name: material_color_utilities
107100
url: "https://pub.dartlang.org"
108101
source: hosted
109-
version: "0.1.4"
102+
version: "0.1.5"
110103
meta:
111104
dependency: transitive
112105
description:
113106
name: meta
114107
url: "https://pub.dartlang.org"
115108
source: hosted
116-
version: "1.7.0"
109+
version: "1.8.0"
117110
path:
118111
dependency: transitive
119112
description:
120113
name: path
121114
url: "https://pub.dartlang.org"
122115
source: hosted
123-
version: "1.8.1"
116+
version: "1.8.2"
124117
sky_engine:
125118
dependency: transitive
126119
description: flutter
@@ -132,7 +125,7 @@ packages:
132125
name: source_span
133126
url: "https://pub.dartlang.org"
134127
source: hosted
135-
version: "1.8.2"
128+
version: "1.9.1"
136129
stack_trace:
137130
dependency: transitive
138131
description:
@@ -153,21 +146,21 @@ packages:
153146
name: string_scanner
154147
url: "https://pub.dartlang.org"
155148
source: hosted
156-
version: "1.1.0"
149+
version: "1.1.1"
157150
term_glyph:
158151
dependency: transitive
159152
description:
160153
name: term_glyph
161154
url: "https://pub.dartlang.org"
162155
source: hosted
163-
version: "1.2.0"
156+
version: "1.2.1"
164157
test_api:
165158
dependency: transitive
166159
description:
167160
name: test_api
168161
url: "https://pub.dartlang.org"
169162
source: hosted
170-
version: "0.4.9"
163+
version: "0.4.12"
171164
vector_math:
172165
dependency: transitive
173166
description:

lib/l10n/intl_ms.arb

Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
{
2+
"@@last_modified": "2022-08-25T21:53:39.706877",
3+
"requiredErrorText": "Ruang ini wajib diisi.",
4+
"@requiredErrorText": {
5+
"description": "Error Text for required field",
6+
"type": "text",
7+
"placeholders": {}
8+
},
9+
"minErrorText": "Nilai wajib lebih besar daripada atau sama dengan {min}.",
10+
"@minErrorText": {
11+
"description": "Error Text for required field",
12+
"type": "text",
13+
"placeholders": {
14+
"min": {}
15+
}
16+
},
17+
"minLengthErrorText": "Nilai mesti mempunyai panjang lebih besar daripada atau sama dengan {minLength}",
18+
"@minLengthErrorText": {
19+
"description": "Error Text for required field",
20+
"type": "text",
21+
"placeholders": {
22+
"minLength": {}
23+
}
24+
},
25+
"maxErrorText": "Nilai wajib kurang daripada atau sama dengan {max}",
26+
"@maxErrorText": {
27+
"description": "Error Text for required field",
28+
"type": "text",
29+
"placeholders": {
30+
"max": {}
31+
}
32+
},
33+
"maxLengthErrorText": "Nilai mesti mempunyai panjang kurang daripada atau sama dengan {maxLength}",
34+
"@maxLengthErrorText": {
35+
"description": "Error Text for required field",
36+
"type": "text",
37+
"placeholders": {
38+
"maxLength": {}
39+
}
40+
},
41+
"equalLengthErrorText": "Nilai mesti mempunyai panjang yang sama dengan {length}",
42+
"@equalLengthErrorText": {
43+
"description": "Error Text for required field",
44+
"type": "text",
45+
"placeholders": {
46+
"length": {}
47+
}
48+
},
49+
"emailErrorText": "Ruang ini memerlukan alamat e-mel yang sah.",
50+
"@emailErrorText": {
51+
"description": "Error Text for email field",
52+
"type": "text",
53+
"placeholders": {}
54+
},
55+
"integerErrorText": "Ruang ini memerlukan integer yang sah.",
56+
"@integerErrorText": {
57+
"description": "Error Text for integer validator",
58+
"type": "text",
59+
"placeholders": {}
60+
},
61+
"equalErrorText": "Nilai Ruangan ini wajib sama dengan {value}.",
62+
"@equalErrorText": {
63+
"description": "Error Text for equal validator",
64+
"type": "text",
65+
"placeholders": {
66+
"value": {}
67+
}
68+
},
69+
"notEqualErrorText": "Nilai ruangan ini wajib tidak sama dengan {value}.",
70+
"@notEqualErrorText": {
71+
"description": "Error Text for not-equal validator",
72+
"type": "text",
73+
"placeholders": {
74+
"value": {}
75+
}
76+
},
77+
"urlErrorText": "Ruangan ini memerlukan alamat URL yang sah.",
78+
"@urlErrorText": {
79+
"description": "Error Text for URL field",
80+
"type": "text",
81+
"placeholders": {}
82+
},
83+
"matchErrorText": "Nilai tidak sepadan dengan corak.",
84+
"@matchErrorText": {
85+
"description": "Error Text for pattern field",
86+
"type": "text",
87+
"placeholders": {}
88+
},
89+
"numericErrorText": "Nilai wajib dalam bentuk angka.",
90+
"@numericErrorText": {
91+
"description": "Error Text for numeric field",
92+
"type": "text",
93+
"placeholders": {}
94+
},
95+
"creditCardErrorText": "Ruangan ini memerlukan nombor kad kredit yang sah.",
96+
"@creditCardErrorText": {
97+
"description": "Error Text for credit card field",
98+
"type": "text",
99+
"placeholders": {}
100+
},
101+
"ipErrorText": "Ruangan ini memerlukan IP yang sah.",
102+
"@ipErrorText": {
103+
"description": "Error Text for IP address field",
104+
"type": "text",
105+
"placeholders": {}
106+
},
107+
"dateStringErrorText": "Ruangan ini memerlukan rentetan tarikh yang sah.",
108+
"@dateStringErrorText": {
109+
"description": "Error Text for date string field",
110+
"type": "text",
111+
"placeholders": {}
112+
}
113+
}

lib/localization/intl/messages_all.dart

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ import 'messages_ja.dart' as messages_ja;
3434
import 'messages_ko.dart' as messages_ko;
3535
import 'messages_lo.dart' as messages_lo;
3636
import 'messages_messages.dart' as messages_messages;
37+
import 'messages_ms.dart' as messages_ms;
3738
import 'messages_nl.dart' as messages_nl;
3839
import 'messages_pl.dart' as messages_pl;
3940
import 'messages_pt.dart' as messages_pt;
@@ -68,6 +69,7 @@ Map<String, LibraryLoader> _deferredLibraries = {
6869
'ko': () => new Future.value(null),
6970
'lo': () => new Future.value(null),
7071
'messages': () => new Future.value(null),
72+
'ms': () => new Future.value(null),
7173
'nl': () => new Future.value(null),
7274
'pl': () => new Future.value(null),
7375
'pt': () => new Future.value(null),
@@ -122,6 +124,8 @@ MessageLookupByLibrary? _findExact(String localeName) {
122124
return messages_lo.messages;
123125
case 'messages':
124126
return messages_messages.messages;
127+
case 'ms':
128+
return messages_ms.messages;
125129
case 'nl':
126130
return messages_nl.messages;
127131
case 'pl':

0 commit comments

Comments
 (0)