Skip to content

Message keys

Every message the package produces goes through a single validator.* key, whether it originates from a rule, a component or the server error mapping. When a project registers its own translate function through createValidation, these are the keys it should provide. Without configuration, the built-in English texts below are used.

Some keys are not tied to a rule at all: validator.notice is shown by ValidationNotice, and keys like validator.emailTaken only occur through the server error mapping.

All keys

KeyUsed byParameters
validator.addressNotValidserver errors
validator.afterDateafterDate
validator.alphaalpha
validator.alphaNumalphaNum
validator.andand
validator.beforeDatebeforeDate
validator.betweenbetween, server errors{min}, {max}
validator.betweenDatesbetweenDates{from}, {to}
validator.bsnbsn
validator.credentialsserver errors
validator.decimaldecimal
validator.emailemail, server errors
validator.emailTakenserver errors
validator.integerinteger
validator.ipAddressipAddress
validator.macAddressmacAddress
validator.maxLengthmaxLength, server errors{max}
validator.maxValuemaxValue, server errors{max}
validator.minLengthminLength, server errors{min}
validator.minValueminValue, server errors{min}
validator.notnot
validator.noticeValidationNotice, server errors
validator.numericnumeric
validator.oror
validator.phoneNumberserver errors
validator.postalCodepostalCode
validator.requiredrequired, server errors
validator.requiredIfrequiredIf
validator.requiredUnlessrequiredUnless
validator.sameAssameAs, server errors{otherName}
validator.urlurl

Ready to paste

The complete set with the built-in English texts, in vue-i18n YAML format:

yaml
validator:
    addressNotValid: "The chosen address is not valid."
    afterDate: "Please choose a date later than the start date."
    alpha: "Please enter only alphabetical characters."
    alphaNum: "Please enter a value containing only letters and numbers."
    and: "Please ensure all requirements are met."
    beforeDate: "Please choose a date earlier than the end date."
    between: "Please enter a number between {min} and {max}, inclusive."
    betweenDates: "Please choose a date within the allowed period."
    bsn: "Please enter a valid citizen service number."
    credentials: "The provided credentials are invalid."
    decimal: "Please enter a valid decimal value."
    email: "Please enter a valid email address."
    emailTaken: "The chosen email address is already in use."
    integer: "Please enter a whole number."
    ipAddress: "Please enter a valid IP address."
    macAddress: "Please enter a valid MAC address."
    maxLength: "Please enter a value with a maximum length of {max} characters."
    maxValue: "Please enter a number less than or equal to {max}."
    minLength: "Please enter a value with a minimum length of {min} characters."
    minValue: "Please enter a number greater than or equal to {min}."
    not: "Please enter a different value."
    notice: "Please address the errors in the form before proceeding with the submission."
    numeric: "Please enter a valid numeric value."
    or: "Please ensure at least one requirement is met."
    phoneNumber: "Please enter a valid phone number."
    postalCode: "Please enter a valid postal code."
    required: "This field is required."
    requiredIf: "This field is required."
    requiredUnless: "This field is required."
    sameAs: "Please ensure this field is the same as the other field."
    url: "Please enter a valid URL."

Custom constraint codes added through createValidation({constraints}) map onto keys of your choosing; add those to your locale files as well.

See also