Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>The proper way is to look at the HTTP <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.4" rel="noreferrer">Accept-Language</a> header sent to the server. This contains the ordered, weighted list of languages the user has configured their browser to prefer.</p> <p>Unfortunately this header is not available for reading inside JavaScript; all you get is <code>navigator.language</code>, which tells you what localised version of the web browser was installed. This is not necessarily the same thing as the user's preferred language(s). On IE you instead get <code>systemLanguage</code> (OS installed language), <code>browserLanguage</code> (same as <code>language</code>) and <code>userLanguage</code> (user configured OS region), which are all similarly unhelpful.</p> <p>If I had to choose between those properties, I'd sniff for <code>userLanguage</code> first, falling back to <code>language</code> and only after that (if those didn't match any available language) looking at <code>browserLanguage</code> and finally <code>systemLanguage</code>.</p> <p>If you can put a server-side script somewhere else on the net that simply reads the Accept-Language header and spits it back out as a JavaScript file with the header value in the string, eg.:</p> <pre><code>var acceptLanguage= 'en-gb,en;q=0.7,de;q=0.3'; </code></pre> <p>then you could include a &lt;script src> pointing at that external service in the HTML, and use JavaScript to parse the language header. I don't know of any existing library code to do this, though, since Accept-Language parsing is almost always done on the server side.</p> <p>Whatever you end up doing, you certainly need a user override because it will always guess wrong for some people. Often it's easiest to put the language setting in the URL (eg. http​://www.example.com/en/site vs http​://www.example.com/de/site), and let the user click links between the two. Sometimes you do want a single URL for both language versions, in which case you have to store the setting in cookies, but this may confuse user agents with no support for cookies and search engines.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload