window.ParsleyConfig = window.ParsleyConfig || {};
window.ParsleyConfig.i18n = window.ParsleyConfig.i18n || {};

// Define then the messages
window.ParsleyConfig.i18n.{{ lang() }} = $.extend(window.ParsleyConfig.i18n.{{ lang() }} || {}, {
  defaultMessage: '{% trans %}This value seems to be invalid.{% endtrans %}',
  type: {
    email:        '{% trans %}This value should be a valid email.{% endtrans %}',
    url:          '{% trans %}This value should be a valid url.{% endtrans %}',
    number:       '{% trans %}This value should be a valid number.{% endtrans %}',
    integer:      '{% trans %}This value should be a valid integer.{% endtrans %}',
    digits:       '{% trans %}This value should be digits.{% endtrans %}',
    alphanum:     '{% trans %}This value should be alphanumeric.{% endtrans %}'
  },
  notblank:       '{% trans %}This value should not be blank.{% endtrans %}',
  required:       '{% trans %}This value is required.{% endtrans %}',
  pattern:        '{% trans %}This value seems to be invalid.{% endtrans %}',
  min:            '{% trans %}This value should be greater than or equal to %s.{% endtrans %}',
  max:            '{% trans %}This value should be lower than or equal to %s.{% endtrans %}',
  range:          '{% trans %}This value should be between %s and %s.{% endtrans %}',
  floatrange:     '{% trans %}This value should be between %s and %s.{% endtrans %}',
  minlength:      '{% trans %}This value is too short. It should have %s characters or more.{% endtrans %}',
  maxlength:      '{% trans %}This value is too long. It should have %s characters or fewer.{% endtrans %}',
  length:         '{% trans %}This field should have between %s and %s characters.{% endtrans %}',
  mincheck:       '{% trans %}You must select at least %s choices.{% endtrans %}',
  maxcheck:       '{% trans %}You must select %s choices or fewer.{% endtrans %}',
  check:          '{% trans %}You must select between %s and %s choices.{% endtrans %}',
  equalto:        '{% trans %}This value should be the same.{% endtrans %}',
  bytelength:     '{% trans %}This field should have between %s and %s characters.{% endtrans %}',
  extratype: {
    ipv4:         '{% trans %}This is not a valid IPv4 address.{% endtrans %}',
    ipv4netmask:  '{% trans %}This is not a valid IPv4 netmask.{% endtrans %}',
    ipv4prefix:   '{% trans %}This is not a valid IPv4 prefix.{% endtrans %}',
    ipv6:         '{% trans %}This is not an IPv6 address with prefix length.{% endtrans %}',
    anyip:        '{% trans %}This is not a valid IPv4 or IPv6 address.{% endtrans %}',
    ipv6prefix:   '{% trans %}This is not a valid IPv6 prefix.{% endtrans %}',
    macaddress:   '{% trans %}This is not a valid MAC address.{% endtrans %}',
    domain:       '{% trans %}This is not a valid domain name.{% endtrans %}',
    datetime:     '{% trans %}This is not a valid time (YYYY-MM-DD HH:MM:SS).{% endtrans %}'
  }
});

// If file is loaded after Parsley main file, auto-load locale
if ('undefined' !== typeof window.ParsleyValidator)
  window.ParsleyValidator.addCatalog('{{ lang() }}', window.ParsleyConfig.i18n.{{ lang() }}, true);
