implementation of localized error messages using the jQuery validation plugin
-
Howdy all!
tl;dr: Any pointers on enqueuing language files related to the jQuery validation plugin in noconflict mode?
I’m pretty fond of the jQuery validation plugin and use it often in projects. I have a plugin here in the public repo that uses it. I got a support request from a user recently that needed Dutch language error messages so I dug in to try to figure how to include that. The translated messages files are available BUT the challenge is that these files aren’t noconflict mode compatible (i.e. they use the global $ shortcut). I did a quick and dirty search/replace to get this particular user sorted out, but I’m wondering if anybody has any pointers on how to include these files.
Lacking your own good ideas, perhaps dynamically creating a file based on
$language = $_SERVER['HTTP_ACCEPT_LANGUAGE']
and then do something likefile_get_contents( 'messages_' . $language . '.js' )
and wrap the result of that up in a noconflict wrapper. Thoughts on that approach?
- The topic ‘implementation of localized error messages using the jQuery validation plugin’ is closed to new replies.