Frontend: i18nΒΆ

Both the labels and the conversion/validation errors may be i18n keys (any place on the backend of frontend that takes a user-visible string, can be a i18n key instead). Some default keys are provided for the standard validators, but custom ones can be provided as well simply by specifying them as members of the i18n option to Supler.Form:

var formContainer = document.getElementById('form-container');
var form =  = new Supler.Form(formContainer, {
  i18n: {
    error_custom_lastNameLongerThanFirstName: "Last name must be longer than first name!",
    error_custom_illegalDateFormat: function(detail) { return "Illegal date format: " + detail; }
  }
});
form.render(formJson); // formJson is received from the server

The values can be either strings, or functions which format the message using the error message’s arguments.