Use Field values in i18n translations
mortezakarimi opened this issue · 1 comments
mortezakarimi commented
I think you can change your validateCustom.js to show field values on errors something like this:
var fieldValue = (typeof model.attributes[validationField][fieldError.rule] === 'undefined') ? '' : model.attributes[validationField][fieldError.rule];
var customMessage = sails.__({
phrase: phrase,
locale: locale
},fieldValue);
and then we can use something like this in translation files
"contact.name.minLength": "minimum length is %s .",
Sorry for my bad English
armellarcier commented
The actual value passed to validation would be nice too.