Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>jQuery validation plugin localization The default language for jQuery validation plugin is English. It could be overridden with the localization js file, eg. es, zh, fr, etc. Please refer <a href="https://github.com/jzaefferer/jquery-validation/tree/master/src/localization">here</a> for the list of supported languages.</p> <p>To enable languages support, we just need to add other language message js into our webpage (html/jsp/xhtml). for french</p> <pre><code>&lt;script type="text/javascript" src="http://jzaefferer.github.io/jquery-validation/localization/messages_fr.js" /&gt; </code></pre> <p>for chinese</p> <pre><code>&lt;script type="text/javascript" src="http://jzaefferer.github.io/jquery-validation/localization/messages_zh.js" /&gt; </code></pre> <p>Same for other languages, just find the appropriate language js and add the js into the webpage.</p> <p>if the required language is not in the list, an workable alternative is to download a copy of the messages_xx.js into project workspace, then modify it to your required language.</p> <p>Although the language js is provided, but the problem is in 1 webpage we can only use 1 type of language message. If multiple language message js in the webpage, the last will be used.</p> <p>To resolve this problem, we can dynamically load the messages js by system locale.</p> <pre><code>&lt;script type="text/javascript" src="http://jzaefferer.github.io/jquery-validation/localization/messages_&lt;%= Locale.getDefault().getLanguage() %&gt;.js" /&gt; </code></pre> <p>with the above solution, finally we can dynamically handle different language message by different system locale.</p> <p>There is another way to handle multiple languages with resource bundle here.</p> <p>related jQuery validation articles:</p> <ul> <li>Email</li> <li>Credit card</li> <li>Multiple form fields</li> <li>Error message customization</li> <li>Using jQuery Validation Plugin in JSF</li> <li>Multilingual error messages</li> <li>Error handling in jQuery Validation Plugin</li> </ul> <p>Done!!</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload