Equanda Message Translation is intended to translate messages to user's locale.
In the page and component templates it uses "equanda-message" binding to identify the message to be translated.
An example of using tapestry component with "equanda-message" binding:
<input t:type="TextField" t:label="equanda-message:edit.value.label" t:value="value"/>
also it can be used as simple property:
${equanda-message:default.error.message}
Translated messages can be used in the java code of the page or component.
To do this you need to inject EquandaMessages interface:
// Injecting messages
@Inject
private EquandaMessages messages;
// Using EquandaMessages to translate message
public String getErrorMessage()
{
return messages.get( "error" );
}
Default translation dictionary in the translations-common.txt file and can be extended by creating a custom translations.txt file.
Translator uses contexts to find specific messages.
Default contexts is:
/page-name/,
"equanda-table",
"equanda-fixed",
"equanda-exceptions",
"app"
"app-exceptions"
and they can be replaced in the tapestry pages by implementing EquandaMessagesGroup interface and using getMessagesGroups() method.
When overriding the message groups, it is recommended to include these anyway.
In principle, you should add translations are in the page specific or "app" contexts (or exceptions in "app-exceptions".
The translations which are in the "equanda-table" context can be deleted from the translations file using the translations tool when that key is no longer relevant based on the domain model.
There is a specific binding which only tests whether there is a message for a given string. It's purpose is to combine with the tapestry if component.
For example in the field template.
<t:if test="has-equanda-message:field.${table.Name}.${field.Name}.help">
<div class="equandaFieldHelp">${dollar}{equanda-message:field.${table.Name}.${field.Name}.help}</div>
</t:if>