I am looking at way to set window.navigator.language programmatically. I was wondering if there was a way to do this using angularjs ?
Currently, I am using localization service to switch get my localization with i18n.
I am looking at way to set window.navigator.language programmatically. I was wondering if there was a way to do this using angularjs ?
Currently, I am using localization service to switch get my localization with i18n.
If your intention is to change the user's browser language then I think you're doomed due to all the security things... However, if your intention is to change the language for the Accept-Language header in web requests you have a better case.
For the latter - check out Angulars $httpProvider.interceptors
.
$httpProvider.interceptors.push(function($q) {
return {
'request': function(config) {
config.headers['Accept-Language'] = 'some locale';
return config;
}
};
});
Good luck :)