Easy_localization: locale only return 'en' 2.0.0+1

Created on 16 Mar 2020  路  6Comments  路  Source: aissat/easy_localization

Hi!

I got problem in 2.0.0+1, locale alwais return 'en'
When i delete fallbackLocale bug gone...

Intl.defaultLocale =
      ui.window.locale.languageCode + '_' + ui.window.locale.countryCode;

  runApp(EasyLocalization(
    child: MyApp(),
    supportedLocales: [
      const Locale('ru'),
      const Locale('de'),
      const Locale('en'),
      const Locale('es'),
      const Locale('it'),
      const Locale('pl')
    ],
    path: 'assets/langs',
    useOnlyLangCode: true,
    fallbackLocale: Locale('en'),
  ));
}
print(Intl.defaultLocale);  /// ru_RU
print(EasyLocalization.of(context).locale.toString()); /// en

P.S.: i clean every time SharedPreferences for reset saved local

Most helpful comment

systemLocale is always return en_EN if you don't run findSystemLocale(), i use ui.window.locale to get device locale and set manualy, its work fine.

I think the problem is in the concept of fallbackLocale
fallbackLocale != starting locale, its wrong... fallbackLocale should set which language to use when there is no locale in supportedLocales.

All 6 comments

@Overman775 fallbackLocale to specify the starting locale of app #65
plz if possible explain more wat u want exactly
maybe this Duplicate of #85

I try get device locale (ui.window.locale.languageCode) and set as default.
But if language not suportet then get 'En' locale.

Maybe duplicate #85, but i don't see code 馃槂

@Overman775 u can get Device locale by Intl.systemLocale #83

systemLocale is always return en_EN if you don't run findSystemLocale(), i use ui.window.locale to get device locale and set manualy, its work fine.

I think the problem is in the concept of fallbackLocale
fallbackLocale != starting locale, its wrong... fallbackLocale should set which language to use when there is no locale in supportedLocales.

@Overman775 u can get Device locale by Intl.systemLocale #83

@Overman775 is right about this. Unfortunately Intl.systemLocale which you recommend to me returns 'en_EN'. Need to use "ui.window.locale". I expect you to add this feature to the package.

89 fix fallbackLocale and now this package get locale from device 馃槂

Was this page helpful?
0 / 5 - 0 ratings

Related issues

AdelMahmoudHussein picture AdelMahmoudHussein  路  7Comments

Wilson13 picture Wilson13  路  7Comments

Melak12 picture Melak12  路  4Comments

deimantasa picture deimantasa  路  4Comments

liudonghua123 picture liudonghua123  路  7Comments