Stop setting the language of your website based on my location

栏目: IT技术 · 发布时间: 5年前

内容简介:Please, stop!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

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


以上所述就是小编给大家介绍的《Stop setting the language of your website based on my location》,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对 码农网 的支持!

查看所有标签

猜你喜欢:

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

高扩展性网站的50条原则

高扩展性网站的50条原则

[美] Martin L. Abbott、[美]Michael T. Fisher / 张欣、杨海玲 / 人民邮电出版社 / 2012-6-3 / 35.00元

《高扩展性网站的50条原则》给出了设计高扩展网站的50条原则,如不要过度设计、设计时就考虑扩展性、把方案简化3倍以上、减少DNS查找、尽可能减少对象等,每个原则都与不同的主题绑定在一起。大部分原则是面向技术的,只有少量原则解决的是与关键习惯和方法有关的问题,当然,每个原则都对构建可扩展的产品至关重要。 主要内容包括: 通过克隆、复制、分离功能和拆分数据集提高网站扩展性; 采用横向......一起来看看 《高扩展性网站的50条原则》 这本书的介绍吧!

在线进制转换器
在线进制转换器

各进制数互转换器

URL 编码/解码
URL 编码/解码

URL 编码/解码

正则表达式在线测试
正则表达式在线测试

正则表达式在线测试