Re: #544: Localization & BeanValidation


Pavel Bucek
 

On 26/05/2017 10:14, Gunnar Morling via Groups.Io wrote:
> Note that Accept-Language is a list of languages, not a single one

Ah, that's a good point, I wasn't aware of that. My feeling is that JAX-RS should select the right Locale (however that would look like), so it can apply it across all sorts of providers/services it interacts with and then pass that one to Bean Validation.

selecting a right locale might be problematic. Imagine you have two resource method, one serving orders and the other one items. Items can be returned in different set of languages than orders.

Then, if we delegate this selection to JAX-RS, we need to support it per resource method? How would SupportedLanguageProvider do that?

Also, it could be that this information is stored in a database and is even item specific. How would be that provider written then? I'm not saying it is not possible, it would bring additional complexity to something, which can be already handled (in application specific way) without providing any real benefit.

The struggle here is with the SupportedLanguagesProvider - it feels like it should be used for something more than BV - I think it's fair to say that if localizaiton of BV error messages is the sole purpose of such provider, it shouldn't be introduced. And I can't think of any other sensible use right now.

Regards,
Pavel



> one of the main motivations for doing this is to provide support for MVC

I'm not so sure about that, I think JAX-RS itself would benefit from it, too.

--Gunnar

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