Few words about `Accept-Language` header.

Ayumu Kasuga
3 min readDec 3, 2017

--

Some time ago, I quit my great job and moved to Vietnam because it’s a nice country with hot weather (weather in Russia is not very friendly in December). Here, I have cheap internet (maybe even a little cheaper than in Russia). It’s fast enough when you connect to a server in Vietnam or in some other Asian countries, but very slow if you download something from a server located in Europe or the USA (about 2–3 MB per second). It’s also okay because many large services use CDN in the Asia region, and loading speed of these services is very good. For example, YouTube works very well. Also, sometimes the AAG cable system experiences some problems, and that affects speed and latency with servers located in the USA. Anyway, you can work as a freelancer from here. But this story is not about internet in Vietnam.

This story is about how sites react when you have a Vietnamese IP address. If you try to open facebook.com, for example:

I see that despite the fact that I have an English interface in my operating system, I also have this header in my request:

According to developer.mozilla.org:

The Accept-Language request HTTP header advertises which languages the client is able to understand, and which locale variant is preferred.

And Facebook has an English language option — actually, I can even choose it manually — so why do I see Vietnamese? The fact that I am here does not mean I can understand the local language (unfortunately).

And Facebook is just one example. Let’s take a look at another site with multi-language support:

Google
Microsoft
Yahoo.com (Actually, it’s okay that I see local news, but a non-English interface is not okay.)

Even some advertisement banners on non-Vietnamese sites look like these:

This banner is from “private mode”, but I frequently see Vietnamese banners in normal mode too.

Of course, not all sites make these mistakes. For example, twitter.com shows me the English interface (but I can choose Vietnamese manually).

When I connect over a Canadian VPN , everything becomes English by default. :)

There’s almost zero probability that someone from one of the large companies mentioned will read this story, but if YOU make multi-language support, please do not look at a client’s IP address. Instead, look at the Accept-Language header (you can use IP address as a backup option).

If I misunderstood something or did something wrong, please feel free to tell me (and others) about it in the comments.

Thank you!

--

--