Issue
I can see the Ionic documentation where it is only mentioned that we can do only this.globalization.getPreferredLanguage()
But I want to do a reverse of this.
I want to programatically set the locale/ Language for the whole app
Solution
Ionic's Globalization plugin allows you to get the preferred language of the device, but you cannot update it.
To define the preferred language in a Angular Ionic application, provide the LOCALE_ID (from @angular/core) in your app module.
{
provide: LOCALE_ID,
useFactory: (getMyLocale) // can be async
// useValue: 'en' // if you want to hardcode it
}
Answered By - Alexis Deprez
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.