如何设置由访问者语言决定的网页语言 [英] How to set language of web page determined by visitor language

查看:35
本文介绍了如何设置由访问者语言决定的网页语言的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

谁能告诉我如何根据访问者的 IP 地址设置网页的语言,以便他自动获取他所在国家/地区的语言的页面.当然,如果该语言是由 Web 开发人员实现的.更好的是,我播下了一些 Google 自动翻译文本的示例.

Can someone tell me how to set language of a web page on the knowledge of IP address of visitor so that he automatically gets page in his country's language. Of course if that language is implemented by web developer. Even better I sow some examples of automatic Google translation of the text.

那么如何让来自美国的访问者在我的页面上以英语获取文本,而来自法国的访问者以法语获取文本.所有由 Google 从第三种原始语言翻译而来的内容.

So how to achieve that visitor from USA gets text on my page in English and visitor from France in French. All that translated by Google from some third original language.

非常感谢.

推荐答案

要么:

  • 从位置猜语言(您可以从他们的 IP 获取).

  • Guess language from location (which you can get from their IP).

查看请求标头的accept-language"值.

Look at the request header's "accept-language" value.

要查看请求标头中的内容,请查看此处:http://www.ericgiguere.com/tools/http-header-viewer.html

To see what's in your request header, have a look here: http://www.ericgiguere.com/tools/http-header-viewer.html

这篇关于如何设置由访问者语言决定的网页语言的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆