Workaround for when the device has no supported languages installed

Previously, this would take the first entry in the supported locales list,
which in our case is Amhraic and is a pretty weird way to chose a locale anyway.
We now default to English.

Closes #127
This commit is contained in:
Roland Geider
2023-02-07 22:03:09 +01:00
parent 0e0ae643cb
commit 92ee141e4a

View File

@@ -154,7 +154,14 @@ class MyApp extends StatelessWidget {
},
localizationsDelegates: AppLocalizations.localizationsDelegates,
supportedLocales: AppLocalizations.supportedLocales,
debugShowCheckedModeBanner: false,
// Workaround for https://github.com/flutter/flutter/issues/100857
localeResolutionCallback: (deviceLocale, supportedLocales) {
if (supportedLocales.contains(deviceLocale)) {
return deviceLocale;
}
return const Locale('en');
},
),
),
);