Hi,
after solving my problem with testing session locale filtering in
thread "Wickettester change locale of request" i found a new problem.
Assume your client browser accepts CHINA - locale by default (first)
and ENGLISH as second. Your application supports FRENCH and
ENGLISH locale. The system locale is FRENCH.
All works great for the localization of wicket components by usage of java
properties fallback system. But what happens if you try to use the
locale in session
for your data-localization (db-access etc)?
Session gets the locale from request which is getting it out of HTTP
header "Accept-Language".
Because first locale is defined - CHINA is set to session. If i filter
session locale
as described in other thread i can see that CHINA is not supported. But
i don't have a
chance to get the other accepted locale (ENGLISH).
There is a similiar discussion here
http://issues.apache.org/struts/browse/STR-2351 .
A solution would be to extract the accepted langauges myself from header
and set default
only if no supported locale is accepted by client-browser. But then i
have to (re)-implement
language extraction similiar to MockHttpServletRequest.getLocale(). But
this breaks the famous
"Don't repeat yourself" programmming rule :-).
A much better approch would be to provide a list of supported locales in
application settings.
So the request could set in automatically and use Locale.getDefault()
only on last exit.
What do you think?
Per
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org