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

startLocale not work #636

Open
mhkarami opened this issue Dec 23, 2023 · 0 comments
Open

startLocale not work #636

mhkarami opened this issue Dec 23, 2023 · 0 comments

Comments

@mhkarami
Copy link

mhkarami commented Dec 23, 2023

this is my code :

  WidgetsFlutterBinding.ensureInitialized();
  await EasyLocalization.ensureInitialized();
...
  runApp(EasyLocalization(
    supportedLocales: const [ENGLISH_LOCALE, PERSIAN_LOCALE],
    path: ASSETS_PATH_LOCALISATIONS,
    fallbackLocale: ENGLISH_LOCALE,
    // startLocale: PERSIAN_LOCALE,
    startLocale: ENGLISH_LOCALE,
    saveLocale: true,
    child: MyApp(),
  ));
class MyApp extends StatelessWidget {
  ...
  @override
  Widget build(BuildContext context) {
    return GlobalProvider(
      child: MaterialApp.router(
        routerConfig: _appRouter.config(),
        locale: context.locale,
        supportedLocales: context.supportedLocales,
        localizationsDelegates: context.localizationDelegates,
        scaffoldMessengerKey: Constants.skaffoldMessengerStateKey,

const String ASSETS_PATH_LOCALISATIONS = "assets/translations";
const Locale PERSIAN_LOCALE = Locale("fa","IR");
const Locale ENGLISH_LOCALE = Locale("en","US");

startLocale not work truly .
some question that asked in stackoverflow with same problem
flutter easy_localization 3.0.2 - default language at boot
How I can set the default language in flutter using easy localization?

also there is a strange behavior :
when i set saveLocale: true app starts with PERSIAN_LOCALE and when i set saveLocale: false app starts with ENGLISH_LOCALE.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant