Hi,
could you please help me with the following problem:
I use wicket 1.3.0 beta 3 + java 1.4.2 + tomcat 5.5
I wrote a small page that has a <wicket:message key="helloWorld">
when running tomcat I get:
[Localizer] Tried to retrieve a localized string for a component that has
not yet been added to the page. This can sometimes lead to an invalid or no
localized resource returned. Make sure you are not calling
Component#getString() inside your Component's constructor. Offending
component: [Page class = com.ppa.ubs.lbs.pages.Login, id = 0, version = 7,
ajax = 0]
Then I wrote a DatabaseResourceLoader implementing IStringResourceLoader
public String loadStringResource(Class clazz, String key, Locale locale,
String style) {
//funny effect locale.getLanguage() --> Nullpointer Exception
//I have to call locale.clone().getLanguage(). Is that normal? ?????
... do some db lookup
}
Then I added some changeLocale-Links to the page constructor:
add( new Link("localeEN"){
public void onClick() {
getSession().setLocale(new Locale("en", "EN"));
}
});
add( new Link("localeDE"){
public void onClick() {
getSession().setLocale(new Locale("de", "DE"));
}
});
The problem: When I change the locale through the Links, the message still
remains the same. The locale passed to the DatabaseResourceLoader always is
DE (german).
Question: Can it be, that the Session-Locale is not used, because of the
Localizer-Problem? Which locale is used instead?
Is there a better way to get database-resource-strings?
Thanks for your help in advance
Best regards
Marcus