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]

2009/10/19 Per Newgro <per.new...@gmx.ch>

> Hi Olivier,
>
> you wrote exactly what i did. But if you check the extraction of locale
> from request
> to provide it in session, you can see that only first accepted language is
> evaluated and used if not-null.
> But if you assume that first accpeted language is CHINESE and second is
> FRENCH and the
> application is supporting FRENCH you don't have any chance to get the
> second locale.
>
> And thats my problem.
>
> 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