Live data from Hacker News

Who uses Accept-Language header?

serpapi.com

1–10 of 71 posts

Re: Who uses Accept-Language header?

#2
There are many many cases when you can’t determine user’s language by location only (immigrants, VPNs, business trips, multinational corporations, countries where people speak multiple languages, etc). If you do any effort in localization, you should recognize Accept-Language. If unsure, you should ask the user for their preferred language directly. Inferring the language by location is not acceptable.

Here in Switzerland, I am so tired of websites offering German localization by default. We don’t speak German in Geneva.

Re: Who uses Accept-Language header?

#3
post #2

There are many many cases when you can’t determine user’s language by location only (immigrants, VPNs, business trips, multinational corporations, countries where people speak multiple languages, etc). If you do any effort in localization, you should recognize Accept-Language. If unsure, you should ask the user for their preferred language directly. Inferring the language by location is not acceptable. Here in Switze…

At work we have it implemented as follows:

1. Check if there is a language cookie set previously 2. If no cookie, check if the Accept-Language is present and contains one of the supported locales 3. If no Accept-Language matches, use the fallback application language

Not that hard to implement, except perhaps parsing the Accept-Language preferences with their quality value can be cumbersome.

Re: Who uses Accept-Language header?

#4
post #2

There are many many cases when you can’t determine user’s language by location only (immigrants, VPNs, business trips, multinational corporations, countries where people speak multiple languages, etc). If you do any effort in localization, you should recognize Accept-Language. If unsure, you should ask the user for their preferred language directly. Inferring the language by location is not acceptable. Here in Switze…

At work we have it implemented as follows: 1. Check if there is a language cookie set previously 2. If no cookie, check if the Accept-Language is present and contains one of the supported locales 3. If no Accept-Language matches, use the fallback application language Not that hard to implement, except perhaps parsing the Accept-Language preferences with their quality value can be cumbersome.

How does the language cookie get set in the first place? Is there any option for the user to set his preferred language?

Re: Who uses Accept-Language header?

#5

Earlier quoted context omitted.

At work we have it implemented as follows: 1. Check if there is a language cookie set previously 2. If no cookie, check if the Accept-Language is present and contains one of the supported locales 3. If no Accept-Language matches, use the fallback application language Not that hard to implement, except perhaps parsing the Accept-Language preferences with their quality value can be cumbersome.

How does the language cookie get set in the first place? Is there any option for the user to set his preferred language?

It is a part of browser's settings (for Chrome and Firefox at least), and it is default to system's default language I think.

Re: Who uses Accept-Language header?

#6
Special mention to Amazon who insist that you want to browse their entire dropshipper directory, on all devices, in the language of whatever you last opened in a non-dubbed version on your TV.

(if the original version is even available, they even find ways to offer some BBC shows, of all things, dubbed-only)

Re: Who uses Accept-Language header?

#7
There are two situations that I hate: 1. I have a different IP than usual, so all the sites change to that country - including language, news and search results(Google), etc, even though my browser sets a list of Accept-Language options. It's still me, I know you track me, so why? 2. Changing a multi-language website to a different country, also changes the language to that country, even though by browser sends an Accept-Language header and they have the translations for the website from their other sites/countries. I don't suddenly start speaking a different language if I look at a your site from a different country.

Re: Who uses Accept-Language header?

#8
post #2

There are many many cases when you can’t determine user’s language by location only (immigrants, VPNs, business trips, multinational corporations, countries where people speak multiple languages, etc). If you do any effort in localization, you should recognize Accept-Language. If unsure, you should ask the user for their preferred language directly. Inferring the language by location is not acceptable. Here in Switze…

[deleted]

Re: Who uses Accept-Language header?

#9
post #2

There are many many cases when you can’t determine user’s language by location only (immigrants, VPNs, business trips, multinational corporations, countries where people speak multiple languages, etc). If you do any effort in localization, you should recognize Accept-Language. If unsure, you should ask the user for their preferred language directly. Inferring the language by location is not acceptable. Here in Switze…

At work we have it implemented as follows: 1. Check if there is a language cookie set previously 2. If no cookie, check if the Accept-Language is present and contains one of the supported locales 3. If no Accept-Language matches, use the fallback application language Not that hard to implement, except perhaps parsing the Accept-Language preferences with their quality value can be cumbersome.

Same as what we do. Only one additional thing: when people log in to their accounts, it switches to the preferred language for that account (and any changes in language selection whilst logged in are also saved into the account preferences).

Re: Who uses Accept-Language header?

#10
> Interestingly, Google does respect the Accept-Language header. While testing in Yelp domain, Google Sign-In widget popup appeared in Japanese.

I’m surprised by this. In my experience, Google are the one big organisation that I can count on to get this completely and utterly wrong. I’ve lost count of the number of times I’ve been stuck with a Google interface, popup, or some other thing that is in a language I don’t speak, just because I was visiting another country. I’ve specifically encountered it repeatedly with the very Google Sign-In widget they say works for them.

Sure, if it happens to be a Google website and you know the magic incantation of &hl=en then you can sometimes work around it, but that doesn’t help when it’s a Google login from another website or something of that nature.

Post reply on HN