When we talk about validation messages, whether in Wicket or Hibernate for example, we always have to keep in mind the internationalization of messages.
To apply internationalization to messages, usually validators indicate which property name should be searched for from the properties related to the desired region, in the case of Wicket, messages can be located in the Application_xx.properties
, that is inside the package wicket-core
.
In your case, the framework is displaying the message in Portuguese, from of these properties.
IConverter.Date='${label}' n\u00E3o \u00E9 um n\u00FAmero v\u00E1lido.
IConverter.date='${label}' n\u00E3o \u00E9 um n\u00FAmero v\u00E1lido.
There are two ways to customize this message:
1) Creating properties for the page/class you are working on
Dentro de um arquivo nomeado MinhaPagina.properties:
meuForm.meuCampoDeData.IConverter.Date='${label}' n\u00E3o \u00E9 uma data v\u00E1lida
meuForm.meuCampoDeData.IConverter.date='${label}' n\u00E3o \u00E9 uma data v\u00E1lida
Note that in this case you must respect the form hierarchy.
2) Creating a global properties for your application
Dentro de um arquivo nomeado Application.properties:
IConverter.Date='${label}' n\u00E3o \u00E9 uma data v\u00E1lida
IConverter.date='${label}' n\u00E3o \u00E9 uma data v\u00E1lida
The settings will always be rewritten by the most specific ones, for example, your application’s properties settings (case 2) will overwrite the framework’s default messages, as well as the settings per page (case 1) will overwrite those of your application (case 2).
More complete models can be found on documentation
One thing I forgot to mention is that ${label}
will be replaced by label
from your field, so you will also need to adjust it so that the message is in line with your expectations.
Thank you very much. It was easier than I thought, for my case it was enough to respect the hierarchy of the form.
– João Tomás