allow i18n error messages with pattern validation

This commit is contained in:
axolotle 2022-01-05 15:56:14 +01:00
parent 679cbde646
commit fd21c9f406

View file

@ -218,8 +218,7 @@ export function formatYunoHostArgument (arg) {
validation.required = validators.required
}
if (arg.pattern && arg.type !== 'tags') {
// validation.pattern = validators.helpers.withMessage(arg.pattern.error,
validation.pattern = validators.helpers.regex(arg.pattern.error, new RegExp(arg.pattern.regexp))
validation.pattern = validators.helpers.regex(formatI18nField(arg.pattern.error), new RegExp(arg.pattern.regexp))
}
validation.remote = validators.helpers.withParams(error, (v) => {
const result = !error.message