3

I know that the content of this variable looks like en-us,en;q=0.5 and that it represents the language the user is using, but how is the browser computing this variable?

The Firefox browser has the option Settings -> Language where one may add languages. What else is used? Does the System language or the current country where the computer/laptop/phone is used change this value? And how does the browser compute the q value for each language?

1 Answer 1

1

The methods vary greatly between browsers. Also many websites may use them in different ways or even ignore this header completely, giving instead priority to other methods such as the hateful geo-localization by IP address.

Most browsers just use the preferred language as set in their configuration (Settings for Languages), or take the easy way out by using the language of the browser UI. See the W3 article Setting language preferences in a browser, section Changing your preferences, how to change these preferences for mobile devices, Edge, Chrome, Firefox and Safari.

IE, Edge and Safari are the only ones that use by default the languages installed in the operating system.

You can use the Internationalization Checker to discover the language(s) currently being requested by your browser.

6
  • So if I understood you correctly, then the geo-localization of the IP address will never change the value of the HTTP_ACCEPT_LANGUAGE header? I used the link that you mentioned and I found that my browser (firefox) uses Accept-Language: de,en-US;q=0.7,en;q=0.3. I am from Germany with a German operating system, I never changed the browsers language settings. So maybe HTTP_ACCEPT_LANGUAGE gets also changed if you just visit pages in a different language often enough?
    – Adam
    Commented Oct 29, 2017 at 21:14
  • There isn't much documentation and certainly no standard. Firefox may take into account installed dictionaries and other hints. Chrome might do it differently. The above syntax means: "I prefer German, but will accept American English and other types of English". This is all only heuristics, where the server also takes part - see Content negotiation.
    – harrymc
    Commented Oct 29, 2017 at 22:31
  • what does the q parameter signify?
    – oldboy
    Commented Jul 31, 2019 at 4:23
  • 1
    @BugWhisperer: See stackoverflow.com/questions/8552927/…
    – harrymc
    Commented Jul 31, 2019 at 5:39
  • yeah i ended up finding that shortly after. is the preferred language always going to be the first parameter in the HTTP_ACCEPT_LANGUAGE header?
    – oldboy
    Commented Jul 31, 2019 at 6:42

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .