2

How can a website determine my language preference (and wrongly, I might add)?

When I browse to a site, it defaults to setting the site language to Afrikaans. I've never selected this before, nor given any indication of such in any site-wide or local browser setting.

But I'm not trying to troubleshoot this specific site, I'm just wondering about the methodology -- how a website is able to determine what language it thinks the user uses -- and whether it's coming from browser settings, or cookies, or headers, etc.

3

Your browser sends an accept-language header, which gives your language preferences. Most sites choose their language based on that header, which you can change in your browser settings. Other sites might do this based on the geolocation of your IP address.

  • In my experience the opposite is true -- most sites ignore the Accept-Language header and instead have different URLs for different languages. Ex. yahoo.jp, whitehouse.gov/espanol, arabic.cnn.com. I'm testing this with a chrome-extension lets you set the header that gets sent, chrome.google.com/webstore/detail/quick-language-switcher/…) – ccnokes Sep 1 '16 at 5:09
  • The question asked for how a website determined language preference. Websites that always use the same language (to me, different URLs are different websites) are out of scope of the question. – user2313067 Sep 1 '16 at 5:13
4

You can take a look at this page to see what headers your browser is sending:
http://pgl.yoyo.org/http/browser-headers.php

The Accept-Language header is particularly important.

If there's nothing unusual in the headers, then some other options are:

  1. How are you connected to the internet? The site may be doing geolocation based on your IP address.

  2. Is there any indication as to the language in the URL you're going to? Somebody may have sent you a URL based on the language they were browsing the site in.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.