mirror of
https://github.com/gabehf/Fladder.git
synced 2026-03-07 21:48:14 -08:00
fix: Locale selection issue with country-specific locales (#383)
This commit is contained in:
parent
3d7a654096
commit
f3e920ac79
3 changed files with 19 additions and 9 deletions
|
|
@ -288,13 +288,15 @@ class _MainState extends ConsumerState<Main> with WindowListener, WidgetsBinding
|
|||
),
|
||||
localizationsDelegates: AppLocalizations.localizationsDelegates,
|
||||
supportedLocales: AppLocalizations.supportedLocales,
|
||||
builder: (context, child) => Localizations.override(
|
||||
context: context,
|
||||
locale: AppLocalizations.supportedLocales.firstWhere(
|
||||
(element) => element.languageCode == language.languageCode,
|
||||
orElse: () => const Locale('en', "GB"),
|
||||
),
|
||||
child: LocalizationContextWrapper(child: ScaffoldMessenger(child: child ?? Container())),
|
||||
locale: language,
|
||||
localeResolutionCallback: (locale, supportedLocales) {
|
||||
if (locale == null || !supportedLocales.contains(locale)) {
|
||||
return const Locale('en');
|
||||
}
|
||||
return locale;
|
||||
},
|
||||
builder: (context, child) => LocalizationContextWrapper(
|
||||
child: ScaffoldMessenger(child: child ?? Container()),
|
||||
),
|
||||
debugShowCheckedModeBanner: false,
|
||||
darkTheme: darkTheme.copyWith(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue