I am using bean validation and gettext for i18n. How can I mark the message string for translation, so it gets extracted with xgettext?
For example
@NotNull(message="Please enter a valid string")
String string;
Normall I call i18n.tr, but how to mark a constant?
Kind regards
Christian
Edit:
At runtime I am using a custom message interpolator for translation.
I am normally not answering my own questions. But for now I came up with following solution:
I am marking my strings as follows in an additional comment (I know not DRY anymore):
I am calling following script in my pom:
This script first calls xgettext normally and then calls sed to remove the comment slashes and pipes to xgettext. Thus I have all my keys in keys.pot.
pom.xml – profile:
I know the build is not platform independent anymore but in a separate profile I can live with it. However, it works also on cygwin for the windows guys.
My messageinterpolator is as follows: