Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

[Feature request] Personnalised message layer #3

Open
SRLKilling opened this issue Jul 30, 2017 · 2 comments
Open

[Feature request] Personnalised message layer #3

SRLKilling opened this issue Jul 30, 2017 · 2 comments

Comments

@SRLKilling
Copy link

Hi,

I've been in trouble with Joi default messages, and after searching a bit about it, I found those two comments made by Joi's developper Marsu :

I've said messages shouldn't be forwarded to end-users as is, mainly for i18n reasons, and I maintain that i18n can't be part of the core joi features, it doesn't mean it can't be i18n-friendly.
Issue #546

It would be better to post-process the errors with your own i18n layer, error messages are in plain English and intentionally targeted at developers, not end-users.
You have everything you need in the return of joi to build your own messages (type of error, key that failed, ...)
Issue #638

He is strongly suggesting to use errors.details to generate messages ourselves, instead of using errors.message

In the current version of react-joi-validation though, users are forced to only get a label-less version of errors.message meaning that personalization or I18n is not possible as is.

It would be a good idea to remove this fixed part of the pipeline and replace it with a hook. For backward-compatibility, this hook could default to the currently implemented version.

About where to put the callback, I was thinking of setting it in the HOC options.
What do you think about this ?

@greena13
Copy link
Owner

greena13 commented Aug 2, 2017

Hey SRLKilling, thanks for your suggestion.

Please bare with me while I try and clarify my thoughts on this. I am hoping to have a more thoughtful reply than I can offer right now, some time soon.

@greena13
Copy link
Owner

Hello again SRLKilling, this one fell through the cracks if I am honest.

I agree that there should be a way to internationalise error messages and it should be consistent with the intentions of Marsu, where possible.

Do you still have a need for this?

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants