DEV Community

Pedro Pimenta
Pedro Pimenta

Posted on

Stop setting the language of your website based on user location

Please, stop!

Why

Setting the language of your website based on the user's location is not the best user experience. People travel, people move and not always do they speak the language of the place they're in.

I'm currently living in Germany for a while, and I know next to nothing of German, so it serves nothing showing me your content in German.

The worst offenders are the ones that first load the default (most of the times, in my experience, English) and then reload or re-paint to show me a language I don't understand.

The solution

A much better way (and probably easier) is to use the user's browser/system language. That's the language I want to read on 99% of the time. Otherwise, why would I have my machine in that language? And if it's not, I will change it myself.

So if my preferred language is English, it doesn't matter where I am, the content will be delivered in that language and I will understand it.

It's also super easy:

var userLang = navigator.language || navigator.userLanguage; 

Thank you. Signed,
Everyone

Top comments (54)

Collapse
 
lampewebdev profile image
Michael "lampe" Lazarski

Yes please stop that!
My system language is English.
I can speak German, English, polish and a little bit of Russian.
But right now I live in Lithuania and I don't speak it.
It is not like any of the other languages and I often can not find the language switch
Because it is written out in words.
I also travel because of my job and yeah try to find that language switch in idk Chinese...

Collapse
 
opshack profile image
Pooria A

Wished Facebook could understand this.

Collapse
 
bigi profile image
Bigi Lui

From a practical UX standpoint I agree with you; but here's a counterpoint.

I actually somewhat enjoyed it when I traveled to Europe (say, France) and I get on Google (whether on my laptop or at a hostel computer) and see it in French. I don't understand a word of French. But it makes the digital experience (Google) match the physical experience (e.g. street signs) and makes me feel more immersed in my travel. It's like "Hey, I'm in France now, I need to learn some French words."

Collapse
 
bengreenberg profile image
Ben Greenberg

I see what you're saying, but it quickly loses its romanticism once you permanently move to a country where you are not fluent in the primary language and you have to do that every single day countless times a day. :)

Even if we strive to learn the native language, as we should if we are living there full-time, sometimes (often) you want to just get the info on the net you need quickly. Your whole life and every second in it doesn't need to be a language lesson.

Collapse
 
thiagomgd profile image
Thiago Margarida

Also, if you are logged on Google, let's say, and you want that immersion, you can just change your google settings to French. But while your settings are to English, why disrespect it?

Collapse
 
enlguy profile image
enlguy

This, almost exactly what my thoughts are.

Collapse
 
bitdweller profile image
Pedro Pimenta • Edited

Yes but I feel like that should be an option and it is not most cases. When I first moved to Spain, I changed my laptop to Spanish and when I was in France I put my mobile phone in French. But because I know something of that language. If I go to Russia... I won't be ableto even click anything :)

Collapse
 
thaiiceland profile image
Kjarri-thaiiceland • Edited

Think if it was the other ways around, if it was your device that would change the system language every time you travel to another country, and image that you will travel to some country in Asia. How romantic would that be?
How will you be able to find Settings and change language to your prefer.
For me, I hate when I go to website and it displays it content in something that I don't understand and there is Nothing in English for you to be able to change the language. The only way is to close that website and sometimes this is very important website that you need to use....
If this was the default behavior on Android or IOS, then these devices would be totally useless when traveling.

Collapse
 
bengreenberg profile image
Ben Greenberg

This post is one I can deeply relate to! I speak the language of the country I live in, but not natively, and while I enjoy continuing to improve and learn, not every moment on the Internet needs to be a lesson in linguistics! My browser is set to English as its language, and that should be a big enough clue to a site. Thanks for posting!

Collapse
 
larsderichter profile image
Lars De Richter • Edited

Thank you so very much for this!

I live in Belgium. As some of you will know we are a country with three languages (not a bilingual country, mind you, one’s language will depend mainly on the region that they live in, Dutch in the north, French in the south and some German in the east; our capital Brussels is a special case: officially it's bilingual Dutch-French, but the numbers of speakers show a different story: French, English, Arabic (different dialects) and only then Dutch).

A lot of websites will mistakenly try to serve me in French (which is the second most spoken language). About 60% of the Belgian population has Dutch (Flemish) as their mother tongue. Although I can read French it takes a lot more effort than Dutch or English. Most of the younger generation is barely able to read or understand French and will prefer English over French all the time. Most teenagers will immediately exit a site in French.

My browser has my language preferences down to Dutch first, then English. My operating system is in English, so why serve me in French? Because I live in a country which has another region where French is the main language. If you are going to do it like this, then please don’t even bother with internationalisation and serve me in English.

For me it is not even a political thing like it would be for many of my countrymen. Imagine how they will react if you try to serve them in the wrong language.They would prefer being served in Ancient Greek over French...

Collapse
 
andreividrasco profile image
Andrei Vidrasco

Living for almost 5 years in different countries(Netherlands, Switzerland), main language of which I don't speak, at the beginning I had same idea. But later, it came to my mind that there is a lot of different situations, in which that's not possible.
If we take local online shops - they have versions in their language and translating it in another language usually doesn't make economical sense.
If we talk about news site, no one is gonna hire multiple journalists to produce news in multiple languages.
If we talk about big international shops(apple, ikea), those who already have let's say English version available. Turns out is not that easy either. There is a lot of content that is country specific, even on international shop sites. And let's take example of Netherlands. They prepare Ikea's local content to what make sense in Dutch. Now should they prepare content in English as well? Or should they just show US/UK version, which often won't make sense because of Dutch specific market?

So, in all cases, the problem is that it requires additional work to prepare content for local market, often without economical sense. If you prepare on Netherlands version of Ikea, English version, should you prepare Chinese as well?
Why English would have more priority? And so on.
Besides, these 3 categories what other sites are bothering you, doing that?

Collapse
 
bitdweller profile image
Pedro Pimenta

Your point is valid and I wouldn't complain about those cases and I don't think someone else will. It's understood that different regions have different products. That would be an impossible feat.

I'm talking mostly about online services and some blogs. The website that sparked this post specifically was this: matterport.com. It opened in english, I was already reading it and then there was a refresh and everything turned to german. Apart from the bad UX of waiting for a reload (*1), there's no content change. It's the same website, the same content. OK, you have different phone numbers for contact but that can be on its own page.

But there are worst offenders. For example, GOG.com, a video games online store/service that I really like, changes the language and then saves it to the browser. I opened it in France, and although I've have for years browsed in the English version, it's now in French, I have to manually change it. It makes no sense, when they can fetch the browser's language.

Google does the same. Google is 100% the same (apart from a few country-specific services, but that's not what this is about). I understand if your search results are relative to where I am, but the interface should be in my language of choice (smartly fetched from my browser/machine preferences). And they can fetch my region to hide the products that they don't offer in my region, in this case, where 98% of it is available globally.

*1: I've built websites where a language reload was important. The first thing we did was load that specific JS that checked the browser's language and then reloaded, which was super fast and there was no repaint

Collapse
 
andreividrasco profile image
Andrei Vidrasco

ok, fair enough.

"And they can fetch my region to hide the products that they don't offer in my region, in this case, where 98% of it is available globally." - what about products that are available in your region, but not in others? should whole site be in english and some products in ducth(because they're available only Netherlands and translating in every other world doesn't make sense?)

but I learnt to live with google chrome and translation of the site.

the bigger problem I have, to be honest is when a platform like PlayStation, offer their store only in local language(like your bank account) and to make it worse, you can't change your country after registration. I had account in Netherlands and now I have either option to continue using dutch version(even I'm not living there anymore) or to lose all my previous purchases and start from scratch :D

Thread Thread
 
bitdweller profile image
Pedro Pimenta

what about products that are available in your region, but not in others? should whole site be in english and some products in ducth(because they're available only Netherlands and translating in every other world doesn't make sense?)

Yes, exactly. The page and info for that product can be on the language that it's available in (in this case, decided by region). But the overall UI and navigation should maintain your language, so you can still navigate and get out of there.

Collapse
 
sargalias profile image
Spyros Argalias

I agree that setting the language based on browser preferences is better than based on location. If you think about it from the user's point of view and the example you described, it makes perfect sense.

A step better than that is to have the language be part of the URL + provide a language option on your website. This is what Google recommends in Managing multi-regional sites. E.g. example.com/en/, or example.com/fr/. Again this makes sense from the user's point of view. If a friend is using your computer and they want to change language, they don't have to mess with browser settings.

Collapse
 
bitdweller profile image
Pedro Pimenta

Of course, this should always be an option. But what gets on my nerves is deciding defaults based on location.

Collapse
 
hdv profile image
Hussein Duvigneau

Even worse is when you manually fix the language in the URL, but the site thinks it knows better and just changes it back based on your location.

Thread Thread
 
sargalias profile image
Spyros Argalias

OMG, I actually laughed when I read your comment... That's quite bad...

Thread Thread
 
hdv profile image
Hussein Duvigneau • Edited

It's especially bad here in Switzerland, since the country has 4 official languages, some sites will force either French or German onto you without letting you switch to the other. Newsflash for those devs: Just because Switzerland has 4 languages doesn't mean every citizen can speak all four of them fluently. Especially us English-speaking immigrants who can't speak any of them :P

Of course it isn't just language. Ubisoft forces currency based on your location (Steam doesn't). Ikea even forces you to make a different account per locale - I get why this might be the easiest solution for the devs, but I'm sure with a bit of effort this doesn't need to be the case.

Collapse
 
sargalias profile image
Spyros Argalias

Agreed.

Collapse
 
ajimix profile image
Adria Jimenez

Yes, even worse the websites that use outdated IP geolocation databases and they think I'm located in different countries than where I'm really are 😩

Collapse
 
bluesmoon profile image
Philip Tellis

Reminds me of the time I was transiting through Hong Kong for a day (this was in 2008). I had to get the street address of a local place. Found a computer kiosk at a tiny Museum of Tea! Unfortunately it was all in Cantonese, including the browser language setting. I went to yahoo.com but it redirected me to yahoo.hk or hk.yahoo.com (I don't remember). This was rather annoying and I worked at yahoo at the time.

Collapse
 
timvisee profile image
Tim Visée

The great thing is that browsers even commonly provide the users preferred language in request headers, so you don't even have to use JavaScript: developer.mozilla.org/en-US/docs/W...

Collapse
 
dev0x0 profile image
Mohamed El Bahja

When I created my LinkedIn account, I don't know how they set my account primary language to french based on my location, but I never used french and my browser is English and my Accept-Language HTTP header value is en, when I contacted them they say I not possible to change the primary language to English, the only solution is to delete the account and create new one (with US IP address)!

Collapse
 
aravindet profile image
Aravind Ravi Sulekha

Some websites are still generated on the server, so it might be helpful to mention the Accept-Language HTTP request header. developer.mozilla.org/en-US/docs/W...

Collapse
 
bitdweller profile image
Pedro Pimenta

Oh definitely. I just meant this post as an idea or concept. In the end I added that JS snippet because that's my area and it's how they're mostly done :)

Collapse
 
sergix profile image
Peyton McGinnis
Collapse
 
bitdweller profile image
Pedro Pimenta

Well, I put it there myself :) But it did stay on the front page for many hours and generated 263 comments, for which I'm very proud :)

Collapse
 
sergix profile image
Peyton McGinnis

Ahh, I should've recognized the username. No shame though! It's been one of the top posts over the past day with around 520 points, which is definitely an accomplishment for Hacker News. 👏🏼

Collapse
 
shane profile image
Shane McGowan

My favorite is Microsoft defaulting their website to Irish if you're in Ireland. And the fact they translated the whole thing is amazing. Not even 1% of the population could read the site like that 💔

Collapse
 
donut87 profile image
Christian Baer

I am kind of the exact opposite...
I also live in Germany. I speak German rather well, as it is my mother tongue. What I do not want, is my interfaces in German as it makes googling for problems so much harder and I do that more often than I should, probably.
So I deliberately set my OS language to English. For websites like BVG (Berlin public transport) I understand, that they are showing me the site in English. I click on "German" and I am fine. I have to do this every single time. This setting is not stored. So please (whoever this is reading) if you give your users the ability to choose a language, store that information indefinitely (or some equivalent).

Collapse
 
bitdweller profile image
Pedro Pimenta

Yes it's the same for me. I'm Portuguese but I'm fluent I English and I have my devices in English and I prefer English languages for UI, except if they're local services. But that is an exception, I don't feel it should be the default.

Some comments may only be visible to logged-in visitors. Sign in to view all comments.