Cornices / cornice

Build Web Services with Pyramid.
https://cornice.readthedocs.io
Other
384 stars 149 forks source link

Translate Error description field when it is a TranslationString type #502

Closed czekan closed 5 years ago

czekan commented 5 years ago

When I add custom validation errors with request.errors.add method (eg. request.errors.add('body', 'filed', _('Message')) ) then cornice will not translate description for me. This behavior is not consistent with colander schema validation where messages are translated automatically with request.localizer.translate method. This PR adds support for auto translation so it will not be necessary to call translation directly while passing description parameter to request.errors.add.

czekan commented 5 years ago

Hi @leplatrem !

I've just added docs for i18n in general. I'm not sure if that's what you wanted? I've also updated CONTRIBUTORS and CHANGES.