My app needs to include the threshold into the message on validation error.
(eg. "Name should be within 15 characters.")
In the case of the message above, the code can be written like this:
req.__('Name should be within %s characters.', User.attributes.name.maxLength);
But sails-hook-validation translate the message inside when the current or default locale is set.
This behavior disturbs to replace the specifier in the message with the value.
The reason is:
Due to that behavior, I don't know what model (and field) the message is for.
I can't get the threshold because the name of the model (and the field) is not known.
So I added the option to disable i18n translation in the hook.
Using this option, I can receive the raw customMessage (formated as "model.field.rule').
Hi,
My app needs to include the threshold into the message on validation error. (eg. "Name should be within 15 characters.") In the case of the message above, the code can be written like this:
But sails-hook-validation translate the message inside when the current or default locale is set. This behavior disturbs to replace the specifier in the message with the value. The reason is:
So I added the option to disable i18n translation in the hook. Using this option, I can receive the raw customMessage (formated as "model.field.rule').
Please pull them if acceptable.