Localization

JavAjax offers a strong and dynamic support for localization, or internazionalization, through a multi-level architecture that gives you the ability to centralize all the generic resources in a single file while keeping specific resources in dedicated files.

First level is the "javajax.properties" file, which is part of the configuration files needed, and contains the default values for validation messages.
At a second level an Action specific resource file can be deployed in the action package. If it exists, framework will look for a specific message in this file. If a valid message can not be found, framework will search in the generic file.
In any case, the best match is searched using the following order:
There are two different kind of resources: messages, used during the validation process or to send messages to the client, and labels, used to localize field labels, parameters, titles buttons and so on.

Validation messages localization

Validation messages are generated using one of the following keys: Any of these keys have a default value, specified in the system properties file javajax.properties.
Also the default keys can be overridden, let's see some example:
You can even have the property written in both files, so that the value in javajax.properties file is always used except for the Action that overrides it.
These are just examples, a specific pattern for the property name is not required, just use the standard you are used to.

Message properties can also be parameterized with placeholders {X}, where X is an integer value indicating the parameter number. Remember that {0} always refers to the fieldName the message was raised for.
Let's see a little more complex example:
The Action method:
protected Response checkUser(@Param(value="username", minLengh=5) String userName) {
    ... }

The properties:
username=User Name
username.string.too.short={0} is invalid, it should be at least {1} characters
When the string.too.short message is raised for the parameter username, the generated message is "User Name is invalid, it should be at least 5 characters".