我正在使用vaadin框架,在我的应用程序中我有:
@Override
public void onRequestStart(HttpServletRequest request,
HttpServletResponse response) {
currentIP = request.getRemoteAddr();
setLocale(request.getLocale());
handle.set(this);
this.request = request;
this.response = response;
}
但是,request.getLocale()返回en_US
,这是我的操作系统区域设置。但是,在用于切换区域设置(https://addons.mozilla.org/cs/firefox/addon/quick-locale-switcher/?src=userprofile)的Firefox插件中,我将其设置为cs_CZ
,但是,getLocale()仍会返回en_US
。
答案 0 :(得分:3)
尝试获取会话区域设置:
UI.getCurrent().getSession().getLocale();
这对我有用。