Your Web News in One Place

Help Webnuz

Referal links:

Sign up for GreenGeeks web hosting
May 17, 2020 11:20 pm GMT

Stop setting the language of your website based on my 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


Original Link: https://dev.to/bitdweller/stop-setting-the-language-of-your-website-based-on-my-location-31h0

Share this article:    Share on Facebook
View Full Article

Dev To

An online community for sharing and discovering great ideas, having debates, and making friends

More About this Source Visit Dev To