quarkiverse / quarkus-renarde

Server-side Web Framework with Qute templating, magic/easier controllers, auth, reverse-routing
Apache License 2.0
78 stars 19 forks source link

_renarde_language cookie is not respected by Hibernate validation #167

Closed gbourant closed 1 year ago

gbourant commented 1 year ago

Hibernate validation ignores the _renarde_language cookie.

FroMage commented 1 year ago

Oh yeah, that's surely true. Do you have a reproducer with internationalised messages? I've never tried this.

gbourant commented 1 year ago

Sure, you can check it here: https://github.com/gbourant/validation

FroMage commented 1 year ago

Thanks!

gbourant commented 1 year ago

in case you need it: curl 'http://localhost:8080/hello' -H 'Accept-Language: en-US,en;q=0.9,el;q=0.8' -H 'Cookie: _renarde_language=el'

FroMage commented 1 year ago

Thanks. Can be done by implementing a LocaleResolver as indicated in https://quarkus.io/guides/validation#validation-and-localization, as done in Quarkus for RESTEasy Reactive and GraphQL. I can add one for Renarde, should be easy.

FroMage commented 1 year ago

Well, I also have to check where it's getting those localised messages from as well.

FroMage commented 1 year ago

Should be fixed. Note that I've renamed the cookie to _renarde_locale to be more in-line with how Quarkus calls these values in the config. I'm not entirely sure about this, but it feels more coherent. Pity that the JDK and Quarkus call this 'locale' while HTTP calls these 'language' 🤷

gbourant commented 1 year ago

It works as expected, thank you.