I think the point here is that the plugin is not his own, and it
wasn't coded to support localisation. But I reckon that using that
approach, if possible, would make maintenance easier.

BTW, the jQuery validation plugin seems to support localization by
default:
http://bassistance.de/jquery-plugins/jquery-plugin-validation/

- ricardo

On Feb 6, 5:22 pm, Eric Garside <gars...@gmail.com> wrote:
> The easiest way to setup for localizations is to do local aliases for
> basically anything important.
>
> The idea is to have definition files (like localization.fr.js,
> localization.en.js) and abstracted variable names. For instance, you'd
> do things like:
>
> jQuery.fn[loc.validationEngine] = function(settings){
>   allRules = loc.allRules;
>
> }
>
> And in the localization files:
> // en.js
> loc = {
>    validationEngine: 'validationEngine',
>    allRules: {'required': {'regex': 'none', 'alertText': '* This field
> is required'}};}
>
> // fr.js
> loc = {
>    validationEngine: 'frenchForValidationEngine',
>    allRules:{'frForRequired': {'frForRegex': 'frForNone',
> 'frForAlertText': '* Ce champs est requis'}};
>
> }
>
> Working like that will allow you to create a fully localized plugin.
> If you just want to localize some output strings, and not the actual
> function names, the same sort of methodology applies. It all depends
> on how you limit your scope.
>
> Also, sorry about the "frForRequired" stuff. I don't speak a lick of
> french. :(
>
> On Feb 6, 1:49 pm, Ricardo Tomasi <ricardob...@gmail.com> wrote:
>
> > allRules appears to be a var (global?) inside the validationEngine
> > function, not a property. Isn't it easier to just rewrite the whole
> > validation js?
>
> > On Feb 6, 12:46 pm, Karnius <cedric.du...@gmail.com> wrote:
>
> > > Hi guys, I got a plugin I want to do the localisation in french. I
> > > decided to go with a similar solution of the UI datepicker.
>
> > > Adding a french js and reparse my json object in french from there.
> > > But it just do not work and i don't have a clue how.
>
> > > Please help
>
> > > Live english version 
> > > :http://www.position-relative.net/formValidator/test.html
>
> > > The core js :
> > > jQuery.fn.validationEngine = function(settings) {
> > > allRules = {"required":{ // Add your regex rules here, you can take
> > > telephone as an example
> > > "regex":"none",
> > > "alertText":"* This field is required"}
>
> > > }
>
> > > ..............................
>
> > > };
>
> > > The French js:
>
> > > jQuery(function($){
> > > $.validationEngine.allRules = {"required":{ "regex":"none",
> > > "alertText":"* Ce champs est requis"} }
>
> > > });

Reply via email to