문제

I am using vaadin framework and in my application I have:

@Override
public void onRequestStart(HttpServletRequest request,
        HttpServletResponse response) {
    currentIP = request.getRemoteAddr();
    setLocale(request.getLocale());
    handle.set(this);    
    this.request = request;    
    this.response = response;
}

however, request.getLocale() returns en_US, which is my OS locale. However, in Firefox addon for switching locales (https://addons.mozilla.org/cs/firefox/addon/quick-locale-switcher/?src=userprofile), I have set up it to be cs_CZ, however, getLocale() will still return en_US.

도움이 되었습니까?

해결책

Try getting the session locale:

UI.getCurrent().getSession().getLocale();

That worked for me.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top