How?
Make a GET
request to https://locale.now.sh/api and get a sorted list of the user's languages.
Why?
In newer browsers you can gain access to an array of the user's preferred languages via window.navigator.languages
. In older browsers, however, that array isn't available. In comes locale, a server-side polyfill to get that list of languages.
Using window.navigator.languages
Using locale.now.sh
Loading...