Luis Alvarado Luis Alvarado - 16 days ago 6
jQuery Question

How to Change JQuery Validator Language Message

Am using the JQuery Validator from http://bassistance.de/jquery-plugins/jquery-plugin-validation/. How can i make it so that the messages are custom and not in english.

Answer

Do it like this:

$(document).ready(function() {
  $("form#login").validate({
    lang: 'en'  // or whatever language option you have.
  });
});

If the language you wish to supply is not one of the default languages, then do this:

$.tools.validator.localize("fi", {
    '*'          : 'Virheellinen arvo',
    ':email'     : 'Virheellinen sähköpostiosoite',
    ':number'    : 'Arvon on oltava numeerinen',
    ':url'       : 'Virheellinen URL',
    '[max]'      : 'Arvon on oltava pienempi, kuin $1',
    '[min]'      : 'Arvon on oltava suurempi, kuin $1',
    '[required]' : 'Kentän arvo on annettava'
});

  $("form#login").validate({
    lang: 'fi'
  });

See these instructions for more.

Comments