Please accept Accept-Language

A bit of backstory …

Living in Belgium can have pretty interesting consequences. The puny country has 3 official languages (Dutch, French & German). Many more languages are spoken, of course, this is the 21st century and there are people of every possible origin here, and most countries are pretty similar in that regard. What’s less common is Belgium’s language divide. The country is split into multiple regions, with each region having a single official language — I’m conveniently ignoring Brussels here. This made some sense historically, after all, people had to fight (quite literally) for the right to speak their language. At least in the Dutch part of the country. French was the lingua franca for long time, and the tiny German speaking bit is the result of a couple of wars and is irrelevant in this discussion.

There are, literally, laws governing the use of languages in Belgium. Notably these laws don’t govern which languages citizens can speak in public, but they do govern which languages governments (and other public bodies) can speak with their citizens (usually that’s exactly 1, barring a few exceptions). Some people (separatist politicians, mostly) get very cross when these laws are broken. After all, we wouldn’t want the whole country to start speaking [insert language]! Or so they say. In my book, the government should speak the language of the people, instead of telling the people what language to speak. Especially in an age where the world is essentially one big network of air and rail routes. And you know, the internet is a thing, and translation tools exist.

Back on track

Back to the topic at hand. As a consequence of living in Belgium, I am often plagued by websites serving up content in the wrong bloody language. Amazon and Google insist on rendering content in Dutch. Microsoft thinks I enjoy French. Hell, even most Belgian websites think everyone speaks French, even though only 40% of the population does.

There are several ways of figuring out which language to use:

  1. Country detection using IP address, and then mapping a country to a language (fucking awful)
  2. Region detection using IP address, and then mapping that to a language (slightly better)
  3. By using the Accept-Language HTTP header (best)

Many websites are only available in one language. And that’s fine, not everyone has the time and money to translate everything into multiple languages. But many large websites do. The Amazons and the Googles of this world. And they are the worst fucking offenders. They wilfully ignore Accept-Language. They detect country/region and invariably pick the wrong language. Google is particularly nefarious, they will give me search results in the wrong language (which are, of course, worthless), presumably because they think this can convince me to create an account so they can spy on me a bit better. Fuck that.

Just parse the header. Every common browser supports this. For the vast majority of users, this will be correct at all times. If it’s not correct (maybe mum speaks English but daughter speaks Mandarin), then it can be changed on a per user basis. It’s super simple for users to do. It’s super simple for web developers to do. And it makes life a lot easier for international users. Especially expats or people who live in countries which can’t uniquely be mapped to languages.

Please, for the love of all that is good, respect the user’s Accept-Language header. And sure, you can still provide a silly little flag 1 icon to let people switch languages.

— Elric


  1. Flags map to territories, not to languages. This is the wrong tool for the job. Languages don’t have icons. And while I’m ranting, don’t translate the list of languages … I don’t know what English is in Hungarian, so it’s useless as a selection option. Keep the language name in its proper language. So English; Nederlands; 日本語; etc. Not 英語; オランダ語; 日本語. ↩︎