-
-
Notifications
You must be signed in to change notification settings - Fork 26
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
Both in android and ios locale always returns 'en' #7
Comments
Following the example code:
I put this in my App component, but the component that shows the current locale is rendered while await is waiting for I18n.initAsync to finish. I am now using the above code in all components, and use forceUpdate() at the end. Even though I doubt that is the correct approach. Maybe this should be labeled as a request for a better example? |
Hello @raarts, |
Thanks! BTW the example also mentions |
Where can i find the expo example you guys are talking about? |
There is not yet an example yet but it's a good idea, I will do that. |
Hi @raarts, based on this issue, @xcarpentier is now recommending that we do this:
But this doesn't make sense to me since componentWillMount runs asynchronously and there's nothing after initAsync. So it could have just as easily been written like this:
In other words, why is async/await needed here? Thanks, |
@alvaro1728 Right. I think the example is incomplete, in real life you want to set
|
I'm getting an unhandled promise rejection on the following async componentWillMount() { Any ideas? |
@napoleonjones In an new app I recently started I also had troubles with i18n I could not fix, I ended up switching to |
My code:
import I18n from 'react-native-i18n';
const deviceLocale = I18n.locale;
returns 'en' on a Dutch emulator. So does
I18n.currentLocale()
Version:
The text was updated successfully, but these errors were encountered: