react-native-i18n: Android app is not updated when changing the language till you refresh the bundle
So here is what happens with Android:
- You change the language on your phone settings
- You go back to the app and you see still the old language (this is not the default case on Android)
On iOS works by the well.
I saw there are some libraries out there to listen for locale changes, restart the app, etc. I think we could include a solution directly here so we have everything in one dependency.
I also tried react-native-restart
and it is not actually working for me so I am working in a solution right now. It restarts the app but not the bundle. I think maybe we won’t need to refresh the bundle if we can export some method to the update locale for this library?
Would you accept a PR which such functionality here?
Thanks!
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Comments: 18
if you want to follow @ferrannp tutorial you may missed some import So full MainActivity.java will be look like this
}
@milon87 Or just:
100% compatible API 😄
EDIT: If you want to memoize the results:
Hey !
Thanks for your answer, I did not know about that package. So I actually wrote about this https://blog.callstack.io/react-native-handling-language-changes-on-android-the-right-way-c883056a8f5c
And I just fixed my case in the native side. Basically:
Works well for me 😃. Not sure if we could add this to your package as optional…? Or maybe in the README?
How about changing the language in in-app settings? Should I re-render the whole app? Cause when I navigate back, the language isn’t changed because the scene doesn’t re-render!!
@melaku468 reload your top level component (a state update is enough)
I still didn’t get the exact solution. But, i used react-native-restart to restart the whole app.