Translating strings in jquery.validate.js

Hello,

I’ve found some strings like “This field is required” that are nowhere to be found in XML files. However, I’ve found:

messages: { required: "This field is required.", remote: "Please fix this field.", email: "Please enter a valid email address.", url: "Please enter a valid URL.", date: "Please enter a valid date.", dateISO: "Please enter a valid date (ISO).", number: "Please enter a valid number.", digits: "Please enter only digits.", creditcard: "Please enter a valid credit card number.", equalTo: "Please enter the same value again.", maxlength: $.validator.format("Please enter no more than {0} characters."), minlength: $.validator.format("Please enter at least {0} characters."), rangelength: $.validator.format("Please enter a value between {0} and {1} characters long."), range: $.validator.format("Please enter a value between {0} and {1}."), max: $.validator.format("Please enter a value less than or equal to {0}."), min: $.validator.format("Please enter a value greater than or equal to {0}.") },
in lub/jquery/plugins/validate/jquery.validate.js.

How can I approach internationalization of those strings? I don’t want to translate them in source as I need at last two language versions.

Hi @szmigieldesign,

Have you checked to see whether the localization strings are already translated for your language? It’s a pretty broadly used tool, so that’s likely. However, we already have an issue open for configuring that plugin to load the appropriate language; see JQuery Validator needs language specified · Issue #2058 · pkp/pkp-lib · GitHub for details.

Regards,
Alec Smecher
Public Knowledge Project Team

Hi @szmigieldesign,

See my latest comment on that issue – there’s a link to another issue that may resolve the problem for you. If there aren’t appropriate localization strings for your language, then you may want to contribute to the project upstream.

Regards,
Alec Smecher
Public Knowledge Project Team