为什么 GWT 忽略浏览器区域设置? [英] Why does GWT ignore browser locale?

查看:27
本文介绍了为什么 GWT 忽略浏览器区域设置?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

GWT gets locale from either the locale property or the locale query string. If neither is specified, it uses the "default" (ie en_US) locale.

Why doesn't it get it from the browser settings?

It seems the only solution to this is to replace your static html launch page with something like a JSP that reads the browser locales and sets the locale or redirects using the query string. There has to be a better solution than this or simply hard-coding a locale, surely?

解决方案

You can also put this switch in your *.gwt.xml

<set-configuration-property name="locale.useragent" value="Y"/>

this will add language selecting based on language selected in browser. You can also control search order for locale by setting

  <set-configuration-property name="locale.searchorder" value="queryparam,cookie,meta,useragent"/>

But beware that in IE this doesn't work - you should develop server-side language pick based on 'Accept-Language' header send by the IE.

这篇关于为什么 GWT 忽略浏览器区域设置?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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