From 35070ad8a07d78adcbefe6c2a7f78288ba3ed7f4 Mon Sep 17 00:00:00 2001 From: Shawn Date: Tue, 11 Jul 2023 12:07:40 -0600 Subject: [PATCH] Allow web platform to try and load locale --- lib/logic/locale_logic.dart | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/lib/logic/locale_logic.dart b/lib/logic/locale_logic.dart index 82843c08..1dab7618 100644 --- a/lib/logic/locale_logic.dart +++ b/lib/logic/locale_logic.dart @@ -13,14 +13,11 @@ class LocaleLogic { Future 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; }