Skip to content

Commit 5eaa7b4

Browse files
authored
Include french translations in list of supported languages (#591)
* Include french translations. Fixes #561 * Add instruction in README to include supported language after translation
1 parent b9d98a9 commit 5eaa7b4

File tree

3 files changed

+19
-4
lines changed

3 files changed

+19
-4
lines changed

README.md

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -603,7 +603,18 @@ function defined in `lib/localization/form_builder_localizations.dart`. This fil
603603

604604
```flutter pub pub run intl_translation:generate_from_arb --output-dir=lib/l10n --no-use-deferred-loading lib/localization/form_builder_localizations.dart lib/l10n/intl_*.arb```
605605

606-
5. Submit your PR and be of help to millions of people all over the world!
606+
5. Include your new language to `FormBuilderLocalization`'s supported languages. Go to `lib/localization/form_builder_localizations.dart` and include the language like so:
607+
608+
<pre>
609+
<code>
610+
@override
611+
bool isSupported(Locale locale) {
612+
return ['en', 'es', <strong>'fr'</strong>].contains(locale.languageCode);
613+
}
614+
</code>
615+
</pre>
616+
617+
6. Submit your PR and be of help to millions of people all over the world!
607618

608619
### Coffee :-)
609620
If this package was helpful to you in delivering your project or you just wanna to support this

example/lib/main.dart

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,19 @@ class MyApp extends StatelessWidget {
1515
theme: ThemeData(
1616
primarySwatch: Colors.blue,
1717
inputDecorationTheme: InputDecorationTheme(
18-
labelStyle: TextStyle(color: Colors.purple),
18+
labelStyle: TextStyle(color: Colors.blueAccent),
1919
),
2020
),
2121
localizationsDelegates: [
2222
FormBuilderLocalizations.delegate,
2323
GlobalMaterialLocalizations.delegate,
2424
GlobalWidgetsLocalizations.delegate,
2525
],
26-
supportedLocales: [Locale('en', ''), Locale('es', '')],
26+
supportedLocales: [
27+
Locale('en', ''),
28+
Locale('es', ''),
29+
Locale('fr', ''),
30+
],
2731
home: HomePage(),
2832
);
2933
}

lib/localization/form_builder_localizations.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ class _FormBuilderLocalizationsDelegate
128128

129129
@override
130130
bool isSupported(Locale locale) {
131-
return ['en', 'es'].contains(locale.languageCode);
131+
return ['en', 'es', 'fr'].contains(locale.languageCode);
132132
}
133133

134134
@override

0 commit comments

Comments
 (0)