Hacker News new | comments | show | ask | jobs | submit login
Advise HN: If auto-detecting language, provide a way to change it
22 points by nathancahill 48 days ago | hide | past | web | 7 comments | favorite
A frustrating UI pattern when traveling around the world. It'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/isn't saved across sessions.

VPNs help solve this problem, but it's an easy to fix UI flaw.

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.

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.

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.

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

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.

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?

I did read about Accept-Language prior to posting and its current situation struck me as suboptimal:


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.

Applications are open for YC Winter 2018

Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | DMCA | Apply to YC | Contact