mirror of
https://github.com/wger-project/flutter.git
synced 2026-02-18 00:17:48 +01:00
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:
@@ -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');
|
||||
},
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user