
Advise HN: If auto-detecting language, provide a way to change it - nathancahill
A frustrating UI pattern when traveling around the world. It&#x27;s great if websites auto-detect your location and set the language on your first visit. But a shocking number do not allow you to change it afterwards, or the implementation is buggy&#x2F;isn&#x27;t saved across sessions.<p>VPNs help solve this problem, but it&#x27;s an easy to fix UI flaw.
======
jfaucett
I've built a lot of websites/apps over my career, almost all of them in
multiple languages and regions, and to me the best practice pattern is this
(if you can do it, sometimes for various legal/company reasons you can't).

Default your app's language to the first match between the languages you offer
and the user/browser's preferred language list. Fallback to English or the
country locale, depending on the app's goals/requirements. If the user still
changes the language , save it in a cookie/session whatever so on repeat
visits the corrected option is selected.

This only solves the language problem though, not regional issues such as an
online store in Germany vs Spain which have different deals and products. This
is why you should keep a clean separation between locales and
regions/countries.

Anyway thats my 2 cents from the trenches.

------
pitaj
Websites should just respect the HTTP Accept-Language header sent in requests.
There's no need to try detecting the language by location, just trust the
browser.

------
assafmo
It sucks that websites "detect" language by location. When I was in Mexico I
always had to use Chrome's auto translate to English because I was sick of
searching for the language chooser.

------
CodesInChaos
My biggest issue with automatic language detection is that many websites use
location to detect language, instead of the http accept headers.

------
rl3
Even then, most website language selectors suck.

It would be nice if language selection happened via the browser UI rather than
the site itself.

Fortunately the future is at least bright on the automated translation front.

~~~
concede_pluto
Every browser I've used for a long time has supported Accept-Language with a
preference list I can change. Are there any that don't?

~~~
rl3
I did read about _Accept-Language_ prior to posting and its current situation
struck me as suboptimal:

[https://developer.mozilla.org/en-
US/docs/Web/HTTP/Headers/Ac...](https://developer.mozilla.org/en-
US/docs/Web/HTTP/Headers/Accept-Language)

In regards to browser support, you are correct—however, changing preferences
can be cumbersome.

Interestingly, there appears to be several browser add-ons that provide
_Accept-Language_ quick-switch capability in the browser UI, and that's more
in line with what I had in mind with my original comment.

