npm vee-validate 1.0.0-beta.0
Dictionaries and Attributes

latest releases: 4.14.7, 4.14.6, 4.14.5...
8 years ago

Changes:

  • Rework how messages are stored within the validator, now there is a new Dictionary class involved which contains the messages generators and the attributes object.
  • validator.validate or validator.validateAll will now return Promise if at least one validation result is a Promise.
  • Fix an issue when passing a configuration when installing the plugin.

Breaking Changes:

  • validator.updateDictionary(dictionary) will accept a different dictionary structure than before to accommodate for the attributes object which was mentioned here #8

Here is what the new dictionary will look like:

const dictionary = {
    en: {
        messages: { ... },    // Your messages to overwrite the default English messages.
        attributes: {    //  Your custom attributes (names) for each field.
            email: 'Email Address',
            // ...
        }   
    },
    ar: {
      messages: { ... },
      attributes: { ... }
    }
};

validator.updateDictionary(dictionary);

The attributes object is not required, it is helpful if you want to display customized names in the error messages. which is surely better than using data-as attribute on each field in your html.

However data-as still takes precedence over the name defined in attributes. The docs were updated with the new details.

This structure will allow flexibility with the contents of the dictionaries in the future.

Don't miss a new vee-validate release

NewReleases is sending notifications on new releases.