Description
I tried to use the getValidatorKeyPrefix() feature to have a more suitable translation key for a RequiredTextField and the « required » message.
But Wicket wasn't able to find my key : the debug log said that it couldn't find my key whereas it is well-formed (getValidatorKeyPrefix() + ".Required").
So i debugged the getMessage(String) and I understood the problem. Arround the line 175 (in Wicket 1.4.5) we find :
// If not found try a more general form [prefix].[key]
if (Strings.isEmpty(message))
{
resource = prefix(prefix, key);
message = getString(localizer, key, formComponent);
}
The comment is good, but the code is wrong : the resource variable isn't used in the getString(...) ! (I think it's a kind of bad copy/paste from surrounding code)
We should find :
message = getString(localizer, resource, formComponent);
I did it and it works.