Re: #544: Localization & BeanValidation

 

A JAX-RS application produces machine-readable information (XML, JSON, etc.), hence it does not support ANY human language by definition. BV provides machine-readable ConstraintViolations for this purpose; the message text plays no role in "real" REST, just like any message text of any Exception is of no interest to the end user. In a RESTful scenario, the translation of the BV exception is up to the front end designer, hence the CLIENT programmer (like MVC API, JSF, JavaFX) just as HE has to find nice and translated phrases for ANY OTHER exception already: Exceptions are INTERNAL and not to be forwarded 1:1 to the end user! So it is up to HIM to define the languages, while the text contained in a server's "error page" should stay in the same language always as it is NOT intended for the end user but for the programmer / administrator / devop! Hence how shall the author of a JAX-RS application ever decide which languages to support? JAX-RS does NOTHING with this information as you already said! In addition, what happens if the application programmer declares to define Chinese, but the BV implementation does not support Chinese? That won't work. I would rather say, this is solely a MVC feature and should not be defined by JAX-RS.

Join jaxrs-spec@javaee.groups.io to automatically receive all group messages.