Olivier Bourgeois schrieb:
Well, you can't change the behaviour of ServletRequest.getLocale() unless
you want to patch your servlet container :)

But you make me think it would be great in the Servlet API to have something
like setAcceptedLocales(Enumeration e) and let the servlet container do the
work of matching the browser locale with your application supported locales.
Anyway, it's out of Wicket's scope :-)

What you can do is do the work in your overloaded WebSession.getLocale() :

    @Override
    public Locale getLocale() {
        Enumeration _enum = ((WebRequest)
request).getHttpServletRequest().getLocales();
        // Do your work with locales _enum here
        return request.getLocale();
    };

getLocales() returns what you are looking for, in my case it is :

[fr, sv, ar, bg, zh_CN, it, en]

Ok didn't checked that in the application itself until now. In my tests it isn't working because MockHttpRequest.getLocales only returns the first locale. So problem maybe related to test. But with my test-first approach i hit the wall on that.
It seems that i have to add a jira for it.

Cheers
Per

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org

Reply via email to