Use user's locale as default app language #59
Use user's locale as default app language #59
Conversation
Any help with the lint issue is also appreciated! It states that |
Don' declare |
@Nasicus Thanks for the info! |
Making it |
I see, still getting used to Ionic so your explanation is much appreciated! Thanks again! :) |
You're welcome. Though it's not ionic, it's a feature from typescript. |
Well, even with this PR the user will continue to see in English because the settings are changed after logging into the profile. So we need to change the default language on model and use |
@luciorubeens That's true, I'll take a look into adding the user's locale as the default language in the settings! |
@luciorubeens The app now tries to use the user's locale as default language. I check agains the currently available translations to see if the locale is available; if it isn't: it reverts to English as default language |
Great, thanks! 👍🏻 |
I like this! 👌 |
When starting the app for the first time, you'll see a short introduction. This introduction was not properly translated when you set a different language, as the translationService still returned the English values. I've deferred the retrieval of the translations by waiting for the platform.ready() call, but I am not sure whether this is the right way to go. If there is a better way to wait for a translation to be set in Ionic, then let me know!
If you want to review this issue, you can do so as follows:
In
app/app.components.ts
, set a different language than 'en' (e.g. 'nl'):this.translateService.use('nl'); // Set your language here
Reinstall the app so you'll see the introduction again. The introduction slides will be in English, while the buttons will be translated into the correct language
Apply the fix in this PR and now the slides should be translated as well!