Live data from Hacker News

Who uses Accept-Language header?

serpapi.com

61–70 of 71 posts

Re: Who uses Accept-Language header?

#61
post #50

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 Ac…

"It's still me, I know you track me, so why?" They're not tracking you for your benefit. Though one does have to think that clickthrough rates and all similar metrics do go plunging when you serve a user a page in the wrong language.

This is just a guess, but I suspect it wouldn't be in The Google's best interest for other engineering departments to be too involved with the ones that deal with data mining, otherwise they'll end up knowing too much. Even if someone working on a particular web product at The Google thought it would be a good idea to use the existing tracking to improve the user experience, I imagine there would be so much organizational friction in place that they're likely to give up.

Re: Who uses Accept-Language header?

#62

In my experience Accept-Language header is pretty unreliable. It tends to just be one of a few values. Between people never updating it, proxies stripping it, people concerned it will make them easier to fingerprint, etc. Also, form an implementation standpoint, translation is a lot of work to get right and some companies may not do it for all languages so they may support the header but just not support the language…

Proxies stripping it? Tell me more.

Re: Who uses Accept-Language header?

#63

Question: Can you include two languages with the same level of preference in the Accept-Language header? The idea is that the website chooses which language (between those two) to use.

There’s ambiguity in the spec in selection itself. f(a-l-input, supported-locales) yields different outputs contingent on what selector youre using, and its not incorrect

Re: Who uses Accept-Language header?

#64

Question: Can you include two languages with the same level of preference in the Accept-Language header? The idea is that the website chooses which language (between those two) to use.

Yes, but if the web site supports both of them, then it will pick whichever one is first in the header. For example, "en;q=1.0,de;q=1.0" technically states you want equal weight to be put on English and German, but the site has to pick one to show you, so it will most likely fall back to the behavior that's used when the quality score isn't provided (such as "en,de"), which is to pick the first one it can service from left to right.

Re: Who uses Accept-Language header?

#65

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.

> Not that hard to implement, except perhaps parsing the Accept-Language preferences with their quality value can be cumbersome. Many web frameworks provide a tool for parsing these for you. If yours doesn't (or you're not using one) you may be able to find a package that does. Some will also do the matching for you, so you can pass it a list of languages you can support alongside the Accept-Language string and it wi…

Ruby on Rails has built in localization and actually respects whatever headers the user agent sends

Re: Who uses Accept-Language header?

#66
I've worked on a couple multi-language/location projects... Usually using the Accept-Language header as the default response to closest match or the default language (en-US fallback). In which case, I would allow for a cookie and/or url override that would set a cookie and redirect.

    https://en-gb.foo.com >> set cookie and redirect to bare domain
    ...?lang=en-GB >> set cookie and redirect without the lang portion
    
    
I'm also a proponent of having a mini-flag for the current language as a dropdown/flyout menu in the upper-right of the header where each local/language has the appropriate flag/representation in addition to the language name IN that language.

You can use just language (en) instead of language+locale (en-US) as desired.

edit: also, make sure you set your cache directive to include the cookie/header in question. You can also work the other way and always use the locale for subdomain.

Re: Who uses Accept-Language header?

#67

Earlier quoted context omitted.

I hate it too. Not only languages change, but many other things like date formatting, mathematical formatting (using commas rather than dots breaks few things around) and currencies too! And it's a pain to fix as settings often collide and with many applications abusing microfrontends you can even end up in conflicts on the very same pages. Google's the worst offender on all of its services and not just search, youtu…

I want "proper" English, SI units and Euro as default currency. For me, the only thing that sort of works is pretending to be Irish.

Irish with US English

Re: Who uses Accept-Language header?

#68

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 Ac…

I hate it too. Not only languages change, but many other things like date formatting, mathematical formatting (using commas rather than dots breaks few things around) and currencies too! And it's a pain to fix as settings often collide and with many applications abusing microfrontends you can even end up in conflicts on the very same pages. Google's the worst offender on all of its services and not just search, youtu…

> Not only languages change, but many other things like date formatting, mathematical formatting (using commas rather than dots breaks few things around) and currencies too!

The most egregious instance of this is Google search with the news articles at the top. When I’m in Thailand, even if Google correctly figures out that I want English, it displays the news articles with the year in the Thai calendar! How many English speakers know that the current year in the Thai calendar is B.E. 2567‽ This is the correct configuration for approximately zero people in the world!

Re: Who uses Accept-Language header?

#69

Earlier quoted context omitted.

You’re talking about the Accept-Language header . They are asking about the cookie. To answer the question, yes, normally you would have some kind of manual switcher that sets the cookie. Please don’t use flags for this, because flags indicate countries, not languages. Don’t make a Russian-speaking Ukrainian seek out the Russian flag, and don’t make an English-speaking Irish person seek out the Union Flag.

> To answer the question, yes, normally you would have some kind of manual switcher that sets the cookie. Please don’t use flags for this, because flags indicate countries, not languages. Don’t make a Russian-speaking Ukrainian seek out the Russian flag, and don’t make an English-speaking Irish person seek out the Union Flag. Yes, why make things easy. :-) Controversial opinion: Flags are great as a visual aid, short…

I gave an example of Russian-speaking Ukrainians. Why are you characterising this as “hurting some linguists' and nationalists' feelings”? It’s not nationalism or pedantry to be offended at being forced to identify with the flag of the country that is currently murdering your friends and family.

Re: Who uses Accept-Language header?

#70
post #20

Earlier quoted context omitted.

You’re talking about the Accept-Language header . They are asking about the cookie. To answer the question, yes, normally you would have some kind of manual switcher that sets the cookie. Please don’t use flags for this, because flags indicate countries, not languages. Don’t make a Russian-speaking Ukrainian seek out the Russian flag, and don’t make an English-speaking Irish person seek out the Union Flag.

I like when the language is in it's own name, eg: Suomi -- makes it easier to find.

Except when the names are in non-Latin script and therefore sorted arbitrarily.
Post reply on HN