1
0
mirror of https://github.com/git-touch/git-touch synced 2025-02-02 08:56:54 +01:00

fix: fallback language (#141)

fixes #140
This commit is contained in:
Shreyas Thirumalai 2021-01-05 17:02:42 +05:30 committed by GitHub
parent 1bee099191
commit 8aa660437f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -17,7 +17,12 @@ class MyApp extends StatelessWidget {
home: Home(),
localeResolutionCallback:
(Locale locale, Iterable<Locale> supportedLocales) {
return locale;
for (final supportedLocale in supportedLocales) {
if (locale.languageCode == supportedLocale.languageCode) {
return supportedLocale;
}
}
return supportedLocales.first;
},
localizationsDelegates: [
S.delegate,
@ -47,7 +52,12 @@ class MyApp extends StatelessWidget {
home: Home(),
localeResolutionCallback:
(Locale locale, Iterable<Locale> supportedLocales) {
return locale;
for (final supportedLocale in supportedLocales) {
if (locale.languageCode == supportedLocale.languageCode) {
return supportedLocale;
}
}
return supportedLocales.first;
},
localizationsDelegates: [
S.delegate,