Allow web platform to try and load locale
This commit is contained in:
parent
23a1741722
commit
35070ad8a0
@ -13,14 +13,11 @@ class LocaleLogic {
|
||||
|
||||
Future<void> load() async {
|
||||
Locale locale = _defaultLocal;
|
||||
if (kIsWeb) return; // exit early on web as [findSystemLocale] throws errors as of Dec, 2022
|
||||
final localeCode = settingsLogic.currentLocale.value ?? await findSystemLocale();
|
||||
locale = Locale(localeCode.split('_')[0]);
|
||||
if (kDebugMode) {
|
||||
// locale = Locale('zh'); // uncomment to test chinese
|
||||
}
|
||||
final localeCode = settingsLogic.currentLocale.value ?? await findSystemLocale();
|
||||
// Try and find a supported locale
|
||||
locale = Locale(localeCode.split('_')[0]);
|
||||
// Fall back to default
|
||||
if (AppLocalizations.supportedLocales.contains(locale) == false) {
|
||||
locale = _defaultLocal;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user