The default validation error messages are imported in your app's validators folder. If you want to change or extend them, all you need to do is create a messages.js file under app/validators.

// app/validators/messages.js

import Messages from 'ember-cp-validations/validators/messages';

export default Messages.extend({
  uniqueUsername: '{description} {username} already exists'
});

Within this object, you can overwrite the default messages or create new messages just like in the example above. If a message of a given type is not found, it will default to the invalid message. Usage examples can be found here

Show:
formatMessage
(
  • message
  • context
)
String

Regex replace all placeholders with their given context

Parameters:

Returns:

getDescriptionFor
(
  • attribute
  • options
)
String

Get a description for a specific attribute. This is a hook for i18n solutions to retrieve attribute descriptions from a translation

Parameters:

Returns:

getMessageFor
(
  • type
  • context
)
String

Get a message with a given type

Parameters:

Returns:

_regex

RegExp private

Regex for matching error message placeholders

defaultDescription

String

Default attribute description if one isnt passed into a validator's options