parsley.js not displaying error messages in french

Related searches

I've got Parsley.js installed and working correctly (dead easy) however I am unable to get it to display error messages in French. I've tried both methods detailed in the documentation But error message continue to display in English.

I've checked the console and there are no errors, I can also load the language file directly in the browser so it is there.

My current code is:

  <script src="/js/parsley/i18n/en.js"></script>
  <script src="/js/parsley/i18n/fr.js"></script>
  <script src="/js/parsley/parsley.min.js"></script>
  <script type="text/javascript">
    window.ParsleyValidator.setLocale('fr');
  </script>

Please advise.

I was also unable to make it work by following the instructions on the parsley.js page.

This is what worked for me, since as of 11/18/2015 following the documentation on the parsley page still doesnt work.

1- Put First the parsley js and then the localization file (from https://github.com/guillaumepotier/Parsley.js/tree/master/src/i18n):

<script src="parsley.min.js"></script>
<script src="i18n/es.js"></script>

2- Edit the localization file: comment the 'import', and add 'window.' before each of the 2 js instructions. example:

//import Parsley from 'parsley';

window.Parsley.addMessages('es', {
  defaultMessage: "Este valor parece ser inválido.",
  type: {
    email:        "Este valor debe ser un correo válido.",
    url:          "Este valor debe ser una URL válida.",
    number:       "Este valor debe ser un número válido.",
    integer:      "Este valor debe ser un número válido.",
    digits:       "Este valor debe ser un dígito válido.",
    alphanum:     "Este valor debe ser alfanumérico."
  },
  notblank:       "Este valor no debe estar en blanco.",
  required:       "Este valor es requerido.",
  pattern:        "Este valor es incorrecto.",
  min:            "Este valor no debe ser menor que %s.",
  max:            "Este valor no debe ser mayor que %s.",
  range:          "Este valor debe estar entre %s y %s.",
  minlength:      "Este valor es muy corto. La longitud mínima es de %s caracteres.",
  maxlength:      "Este valor es muy largo. La longitud máxima es de %s caracteres.",
  length:         "La longitud de este valor debe estar entre %s y %s caracteres.",
  mincheck:       "Debe seleccionar al menos %s opciones.",
  maxcheck:       "Debe seleccionar %s opciones o menos.",
  check:          "Debe seleccionar entre %s y %s opciones.",
  equalto:        "Este valor debe ser idéntico."
});

window.Parsley.setLocale('es');

The ultimate documentation, Parsley is a dead simple javascript form validation, powerful and UX aware. parsley-show-errors, true, Choose to show or not Parsley error messages� It doesn't, it displays "This value is required" underneath the first checkbox if none are checked. See this CodePen for an example. 👍 1

Parsley relies on jQuery (>= 1.8), and it would need to be included before including Parsley.

Parsley.js Documentation & API, Parsley, the ultimate frontend javascript form validation library. Javascript form validation is not necessary, and if used, it does not replace a strong backend server Parsley comes with various error messages for its built-in validators. In this example, we'll load both French and Italian translations, and use French: hi, it would be great if there is a mechanism to add errors manually to the container without defining validator, one case for that is that i want to get server errors and want to inject them to a desired field. another thing is it would

If anyone see this and search for answer:

I could fix this Problem for me by adding "$( document ).ready(function() {}" around the code.

$( document ).ready(function() {
  Parsley.addMessages('fr', {
    defaultMessage: "Cette valeur semble non valide.",
    type: {
      email:        "Cette valeur n'est pas une adresse email valide.",
      url:          "Cette valeur n'est pas une URL valide.",
      number:       "Cette valeur doit être un nombre.",
      integer:      "Cette valeur doit être un entier.",
      digits:       "Cette valeur doit être numérique.",
      alphanum:     "Cette valeur doit être alphanumérique."
    },
    notblank:       "Cette valeur ne peut pas être vide.",
    required:       "Ce champ est requis.",
    pattern:        "Cette valeur semble non valide.",
    min:            "Cette valeur ne doit pas être inférieure à %s.",
    max:            "Cette valeur ne doit pas excéder %s.",
    range:          "Cette valeur doit être comprise entre %s et %s.",
    minlength:      "Cette chaîne est trop courte. Elle doit avoir au minimum %s caractères.",
    maxlength:      "Cette chaîne est trop longue. Elle doit avoir au maximum %s caractères.",
    length:         "Cette valeur doit contenir entre %s et %s caractères.",
    mincheck:       "Vous devez sélectionner au moins %s choix.",
    maxcheck:       "Vous devez sélectionner %s choix maximum.",
    check:          "Vous devez sélectionner entre %s et %s choix.",
    equalto:        "Cette valeur devrait être identique."
  });

  Parsley.setLocale('fr');
});

Parsley - The ultimate documentation, UX-awareness. Its aim is here to show a quick overview of data-API and Parsley customizable behavior Min char validation: Parsley by default does not proceed with field validation when less than 3 chars have been input. Do not assault your users with error messages to soon! (this behavior Eg: for French messages: oh my god excuse my ignorance, i did not see it, thanks a lot this is awesome, but is it possible to improve the API so there wont be need to clutter the code with to many data-attribute like i mentioned above, it is more elegant. plus is there ability to pass string.format tokens like i mentioned above ? this will make it super

Parsley.js Documentation & API, The issue appears only when I use Parsley with ReactJs I have a simple Not displaying Error Messages when used with react (with ES6) #1094 Whenever the validation occurs, red border appears on the input but does� Windows Live Mail Message Body Not Showing – An Apt Solution! If you find that the aforesaid methods didn’t work for you, then simply adopt the most trusted software i.e, EML to PST Converter . This is because the tool renders the best set of features that lets users convert the EML file to PST format.

Not displaying Error Messages when used with react (with ES6 , Join GitHub today. GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.

Heads up! W3C standards: Parsley by default use parsley-API, which is so nice and simple, but absolutely not W3C valid. This is a personal choice, deal with it :) But, if you really want to be W3C compliant, feel free to configure your own DOM-API namespace by overriding Parsley default configs or using data-parsley-namespace="data-parsley-" and use data-parsley-validate to auto bind forms.

Comments
  • did you add jquery.js ? Parsley relies on jQuery (>= 1.8), and it would need to be included before including Parsley.
  • @SebriZouhaier is probably right. Your code seems to work as it is. You can take a look at this jsfiddle, where your code works correctly. If you have any issue, post a jsfiddle.
  • I've got jQuery 1.11.1 - tested with 1.8.0 and no change English only.
  • @CreateSean Do you have javascript errors? Are you sure the locale files are being loaded ?
  • No js errors and yes all locale files are loaded, I can see them in the inspector.