6

Is it possible to override the default omnifaces validation messages with a jsf message-bundle?

my message-bundle:

javax.faces.converter.DateTimeConverter.DATE={2}: ''{0}'' could not be understood as a date.
javax.faces.converter.DateTimeConverter.DATE_detail=Invalid date format.
javax.faces.validator.LengthValidator.MINIMUM=Minimum length of ''{0}'' is required.

org.omnifaces.component.validator.ValidateUnique=1. my validateUnique omnifaces msg, {0}
org.omnifaces.component.validator.ValidateUnique.DEFAULT_MESSAGE=2. my validateUnique omnifaces msg, {0}

i know there is an 'message' attribute but it would be nice to have all message at one place.

many thanks in advance

BalusC
  • 992,635
  • 352
  • 3,478
  • 3,452
Khinsu
  • 1,439
  • 10
  • 26

1 Answers1

3

This is currently not supported by OmniFaces validator components. As you can see in the source code of ValidateMultipleFields#showMessage(), it's nowhere obtaining the default message from the message bundle as identified by Application#getMessageBundle().

I reported an issue so that the OmniFaces guys are noticed about it and may implement it for the next version. In the meanwhile your best bet is to keep using the message attribute. You can if necessary refactor the code duplication into a custom tagfile.

BalusC
  • 992,635
  • 352
  • 3,478
  • 3,452
  • Thank you, is there a way to get a notification when Omnifaces will have implemented it? Would you be so kind roughly outline, to do it by myself? – Khinsu Jun 12 '14 at 06:28
  • Click the issue link and either press the subscribe button, or post a comment which will autosubscribe you. – BalusC Jun 12 '14 at 06:52