Personal notes on software development.
For Java technologies check my dedicated site

Pages

Documentation

Download a project with the plugin incorporated to test it jQuery test project (download).


Internationalization notes

This info was found here.
The plugin has localization, just add/import your language file in the <head> tag and all error messages will be displayed in that language.
<script type="text/javascript" src="lib/jquery-validate/jquery.validate.js"></script>
<script type="text/javascript" src="lib/jquery-validate/localization/messages_pt.js"></script>

where "messages_pt.js" contains translations of the original english messages of "jquery.validate.js":
/*
 * Translated default messages for the jQuery validation plugin.
 * Language: PT
 */
jQuery.extend(jQuery.validator.messages, {

    required: "Campo obrigatório",
    remote: "Corrigir campo",
    email: "Endereço inválido",
    url: "URL inválido",
    date: "Data inválida",
    dateISO: "Data inválida (ISO).",
    number: "Número inválido",
    digits: "Apenas dígitos",
    creditcard: "Número de cartão inválido",
    equalTo: "Reintroduza o mesmo valor",
    accept: "Please enter a value with a valid extension.",
    maxlength: $.validator.format("Limite max. de caracteres: {0}"),
    minlength: $.validator.format("Introduza pelo menos {0} caracteres"),
    rangelength: $.validator.format("O número de caracteres deverá estar compreendido entre {0} e {1}"),
    range: $.validator.format("Introduza valor entre {0} e {1}"),
    max: $.validator.format("Valor deverá ser inferior ou igual a {0}."),
    min: $.validator.format("Valor deverá ser superior ou igual a {0}.")
});
So if your app has a language toggle option you can import the respective language file using server side script.

No comments:

Post a Comment