I want to access the user browser settings and change the browser language, is this possible using Javascript?
If it's possible, how can I access this? (sample code please)
To get the user's locale in the browser, access the first element of the languages property on the navigator object, e.g. navigator. languages[0] . The property returns an array of strings that represent the user's preferred languages.
Go to the settings -> Scroll down to and click "Show advanced settings..." -> Click "Language and input settings..." -> Then select you're desired language, click done and restart your browser.
You can detect, but cannot set.
var lang = navigator.language || navigator.userLanguage;
// navigator.language : Netscape & Firefox
// navigator.userLanguage : Internet Explorer
If you want to output different languages, the best way is to do it server-side. Either:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With