Jesway / flutter_translate

Flutter Translate is a fully featured localization / internationalization (i18n) library for Flutter.
MIT License
401 stars 118 forks source link

Android : app has to be restarted to notice the change of system language #20

Closed nibo closed 4 years ago

nibo commented 4 years ago

I have to restart the android app to notice the system language change. On ios the app will be automatically rebuild.

Any ideas to solve this?

bratan commented 4 years ago

@nibo - Basically the system locale is only retrieved/used during the application initialization.

Changes to the system locale while the application is running are not currently detected on Android.

On iOS, as you mentioned, the app is rebuilt so the new locale is picked up during initialization.

I`m going to implement this behavior for Android as well, in the near future.

Until then, you could use the ACTION_LOCALE_CHANGED intent to detect the locale change and select the new locale if supported.

bratan commented 4 years ago

Moved to https://github.com/bratan/flutter_translate/issues/21