doudun1029 2011-12-20 21:47
浏览 29
已采纳

什么是检测语言的最佳方法? [关闭]

im making a website (wordpress multisite) which is supported by 2 languages for users, there 2 methods we will use it one:

-Detect language by Geo IP

-Detect Language by Internet Browser

Which is the best method to use it?

Thanks in Advance!

  • 写回答

1条回答 默认 最新

  • douxiongzhen2126 2011-12-20 21:55
    关注

    If I were you I'd follow this list:

    1. If the user is a registered user, set the language according to his/her preferences

    2. If the user has been on the site before, using language X, use that (store the language option in a cookie).

    3. If the http header Accept-Language is present, try to make use of it (you obviously don't support all the languages in the world). In PHP you can get a hold of this value through $_SERVER['ACCEPT_LANGUAGE'].

      I have seen people make use of Accept-Charset as well, trying to narrow it down if the languages specified (in Accept-Language) can't be used, that is kind of a long shot though.

    4. Final option is to use Geo IP to try and figure out where in the world the user might be, and what language is spoken there. This is a tough one though since the official language in a country might not be the one preferably used by the end user.


    As long as the user can easily change language and isn't bound to any of the above presets there shouldn't be any problem.

    .. and please; try to keep track of what language a user has been using before so that he or she doesn't have to change language every time he/she visits your site.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 无线电能传输系统MATLAB仿真问题
  • ¥50 如何用脚本实现输入法的热键设置
  • ¥20 我想使用一些网络协议或者部分协议也行,主要想实现类似于traceroute的一定步长内的路由拓扑功能
  • ¥30 深度学习,前后端连接
  • ¥15 孟德尔随机化结果不一致
  • ¥15 apm2.8飞控罗盘bad health,加速度计校准失败
  • ¥15 求解O-S方程的特征值问题给出边界层布拉休斯平行流的中性曲线
  • ¥15 谁有desed数据集呀
  • ¥20 手写数字识别运行c仿真时,程序报错错误代码sim211-100
  • ¥15 关于#hadoop#的问题