简体   繁体   中英

Bypass parsley.js localization catalog and use gettext() in js

I'm using parsley.js for client-side validation - so far so good!

I'm using transifex to store messages for localization. I would like to find a way to use something like gettext() in the javascript for message translation instead of the parsley catalogs. What is the correct way to do this? I've tried updating the english (default) messages and it doesn't seem to work. I'm new to Parsleyjs so forgive me if I'm asking an obvious question but I can't figure it out.

This is not working (from parsley.js):

Parsley.addMessages('en', {
    defaultMessage: gettext('This field seems to be invalid.'),
    ...

您可以覆盖window.Parsley.getErrorMessage以适合您的需求。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM