I can’t sleep, so it’s time for a rant about redirecting users based on their country IP address.
Just because I am in a country, does not mean I want to be shown a site in that countries language! Okay, some of you might be thinking this sounds perfectly reasonable, because most people in country will be able to read that language. Well, I am here to let you know you are wrong ;)
So what is the correct solution to choosing which language to show your website visitors?
Answer: Web browser cultural settings!
Yes, your browser tells a web server your preferred language.
Examples of why you should check cultural browser settings and not redirect on IP address:
- You may be a traveler who doesn’t speak that language.
- You may be a local person who prefers to use a different language. Some countries even have multiple languages, eg Switzerland as four national languages, 3 official languages at a national level. I’ll leave you to go check Wikipedia if you don’t know what they are.
- There might be more, but the first one is the most important, because that is often me. Okay, the poor person in an Internet cafe or a local computer may end up out of luck, but that is why you also need a good solution for letting a person change the language. This also goes for a localized site you have sent them to.
Point in case. The other day I logged into the Origin site (a computer game store/publishing platform). For the life of me, I could not find how to change my language settings. Maybe it was there, but after searching for a few minutes I got fed up and quit. Origin seem to have a bad enough reputation as it is without adding more misery to their users.
So… on the landing page, you need to provide the user some options to get where you want to be.
Country flags are often nice. A flag stands out and is recognizable as a way to change a language. Even some text will do with an option to select a new language, especially if you support only two. At the top of the page is nice, although some sites make you hunt down the bottom of the page. Even an animation on entry might be a nice way to where to find the language options.
Another nicety would allow the user to go back to the site you redirected them from. Sometimes I really did want to go to blah.com and not blah.hm (you can look that domain extension up too, apparently it is barren, uninhabited and volcanic ;)
Last time I wrote a site that required multiple languages, I was using ASP.NET MVC. I even made some notes I just found.
Each HTTP request includes a header field “Accept-Language” and contains languages the user’s browser supports, eg:
ASP.NET will provide you with a Culture and a UICulture.
Culture will let you know preferred date, number and currency formatting, etc. This could even be used to decide a display currency, although I am not sure if this is the best option right now. I’m mainly ranting about languages right now.
CultureUI should be used to decide which resources to load. So this is where you should be deciding which language to display.
So go forth my minions and change all those websites that have been annoying me over the years. Rage against the IP language redirection!
You can use your IP checking for things like Amazon Affiliates program. For some horrible reason, Amazon make you sign up to each or their different countries and send the appropriate affiliate code and URL.