Question

For a website we're about to implement automatic country/language selection, but still giving the user the choice to change it.

First of all, if the user enters the website using a domain with a country-level TLD they will be presented the correct language by default. But the question is what should the logic be if they come from generic/international TLD such as .com. Should we prefer using the country we get through their IP address or should we use their browser locale? If both, in which sequence?

As such, I was thinking of this hierarchy:

  1. Use User selection if it was changed before. If it has never been set explicitly by the user:
  2. Use hostname TLD. If it is generic (.com):
  3. Use browser locale. If no locale set or no corresponding language version is available for this locale:
  4. Use IP address. If no corresponding language version is available for the detected country:
  5. Use English.

Thanks!

Was it helpful?

Solution

As most countries have several official languages you should rely first on user preferences and then on browser locale, TLD, IP and then english as 'default' (or any major language of your main user base)

OTHER TIPS

I would suggest the browser locale rather than the IP address, as one may live elsewhere but prefer a language other than the standard one for that country.

Browser locale as it is the user choice. When a french man is traveling to England with his laptop, he wants browser locale to be respected not IP.

browser locale should be before ip address,

I'm a native english speaker living abroad, I get annoyed with websites that automatically give me my resident countries language when my browser locale is set to english.

IP address matching would require an (expensive) geo/ip lookup database, a commitment and infrastructure to maintain that, has significant problems with block IPs, and ultimately doesn't even give you the information you want because there isn't a 1:1 relationship between country and language (officially: Canada, or unofficially: United States), not even close.

I prefer cookie preference degrading to TLD/subdomain (or local settings where TLD is language agnostic).

Listen folks, I am not sure where you guys are at, I reside in Finland at the moment, and let me tell you, ONE OF THE MOST FRUSTRATING THINGS MUST BE when the IP address is used to choose the language. It absolutely messes up everything, I am pulling my hair, especially anything related to Google, in fact, I simply cannot use Blogger at all, so if you have any influence over this, PLEASE!!!!!

You also have to allow for people coming in through web proxies not being in the locale their apparent IP address is.

I get a lot of adverts for San Diego based businesses even though I'm in New Zealand, because I use a web proxy there.

Personally I'd simply go with your primary audience's language on the landing page which is just a language selection page and the user has to select a language to proceed. That sets a cookie so that next time the user visits (from the same browser on the same machine) it redirects the correct language site.

I have several reasons for this.

  1. It's easier to code - no checking IP ranges or browser locale etc. Less code means there's less to go wrong.
  2. You're not assuming anything about the user. They might be an American using a machine set to German in Japan for example.
  3. It's likely to be correct :)
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top