An Interest In:
Web News this Week
- April 25, 2024
- April 24, 2024
- April 23, 2024
- April 22, 2024
- April 21, 2024
- April 20, 2024
- April 19, 2024
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
Dev To
An online community for sharing and discovering great ideas, having debates, and making friendsMore About this Source Visit Dev To