Skip to content

Commit b55eab4

Browse files
committed
update readme
1 parent 1db7bec commit b55eab4

File tree

3 files changed

+7
-1
lines changed

3 files changed

+7
-1
lines changed

README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ And you can still add your custom error messages.
103103

104104
### Setup
105105

106-
To allow for localization of default error messages within your app, add `FormBuilderLocalizations.delegate` in the list of your app's `localizationsDelegates`
106+
The default error message is in English. To allow for localization of default error messages within your app, add `FormBuilderLocalizations.delegate` in the list of your app's `localizationsDelegates`
107107

108108
```dart
109109
return MaterialApp(
@@ -171,6 +171,10 @@ TextFormField(
171171
),
172172
```
173173

174+
### Modify the default error message in a specific language
175+
176+
see [override_form_builder_localizations_en](example/lib/override_form_builder_localizations_en.dart) for more detail.
177+
174178
## Support
175179

176180
### Contribute

example/lib/main.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ class MyApp extends StatelessWidget {
2323
],
2424
localizationsDelegates: const [
2525
...GlobalMaterialLocalizations.delegates,
26+
// Placed in front of `FormBuilderLocalizations.delegate`
2627
OverrideFormBuilderLocalizationsEn.delegate,
2728
FormBuilderLocalizations.delegate,
2829
],

example/lib/override_form_builder_localizations_en.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ class OverrideFormBuilderLocalizationsEn
1212

1313
static const List<Locale> supportedLocales = [Locale('en')];
1414

15+
// Override a field and return your translation.
1516
@override
1617
String get requiredErrorText => 'override: This field cannot be empty.';
1718
}

0 commit comments

Comments
 (0)