Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

This application's locale, en_US, is not supported by all of its localization delegates. #455

Closed
horo99 opened this issue Aug 7, 2022 · 4 comments · Fixed by #459
Closed
Labels
bug Something isn't working

Comments

@horo99
Copy link

horo99 commented Aug 7, 2022

Warning: This application's locale, en_US, is not supported by all of its localization delegates.

• A FluentLocalizations delegate that supports the en_US locale was not found.

The declared supported locales for this app are: en_US


the version i'm using is 3.12.0

@horo99
Copy link
Author

horo99 commented Aug 7, 2022


class MyApp extends StatelessWidget {
  const MyApp({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return FluentApp.router(
      title: 'Flutter Demo',
      debugShowCheckedModeBanner: false,
      theme: ThemeData(
        accentColor: Colors.blue,
        brightness: Brightness.dark,
        visualDensity: VisualDensity.adaptivePlatformDensity,
      ),
      localeResolutionCallback: (locale, supported) {
        return const Locale('en', 'US');
      },
      localizationsDelegates: [
        GlobalWidgetsLocalizations.delegate,
        GlobalMaterialLocalizations.delegate,
        GlobalCupertinoLocalizations.delegate,
        LocalJsonLocalization.delegate,
      ],
      supportedLocales: const [
        Locale('en', 'US'),
      ],
      routerDelegate: Modular.routerDelegate,
      routeInformationParser: Modular.routeInformationParser,
      color: Colors.blue,
    );
  }
}

@bdlukaa
Copy link
Owner

bdlukaa commented Aug 7, 2022

You must add DefaultFluentLocalizations to localizationDelegates

@horo99
Copy link
Author

horo99 commented Aug 7, 2022

You must add DefaultFluentLocalizations to localizationDelegates

Thans for your timely reply, but it didn't work.

After adding countryCode: 'US' like below, the warning disappeared.
image

In file localization.dart, maybe the implement of support method needs to be refined.

  static bool supports(Locale locale) {
    return S.delegate.supportedLocales.contains(locale);
  }

@bdlukaa bdlukaa added the bug Something isn't working label Aug 7, 2022
@bdlukaa
Copy link
Owner

bdlukaa commented Aug 8, 2022

Reproducible.

Logs:

══╡ EXCEPTION CAUGHT BY WIDGETS ╞═══════════════════════════════════════════════════════════════════
The following message was thrown:
Warning: This application's locale, en_US, is not supported by all of its localization delegates.

• A FluentLocalizations delegate that supports the en_US locale was not found.

The declared supported locales for this app are: en_US

See https://flutter.dev/tutorials/internationalization/ for more information about configuring an
app's locale, supportedLocales, and localizationsDelegates parameters.
════════════════════════════════════════════════════════════════════════════════════════════════════

Another exception was thrown: No FluentLocalizations found.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants