Changeset 1411

Show
Ignore:
Timestamp:
14/12/09 13:21:27 (3 months ago)
Author:
karel
Message:

Prefixed error messages with i18n:

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/modules/kauri-forms/kauri-forms-framework/src/main/kauri/static-{build}.key/kauri.forms/basic-validators.js

    r1361 r1411  
    3838 
    3939                if (value.constructor != Number || isNaN(value)) 
    40                     return this.notifyFail("Not a number."); 
     40                    return this.notifyFail("i18n:Not a number."); 
    4141 
    4242                var intValueStr = value.toFixed(0); 
     
    4444 
    4545                if (intValueStr != valueStr) 
    46                     return this.notifyFail("Not a valid integer!"); 
     46                    return this.notifyFail("i18n:Not a valid integer!"); 
    4747 
    4848                return this.notifySuccess(); 
     
    5353            validate : function( value) { 
    5454 
    55                 if ($.isEmpty(value)) 
    56                     return this.notifyFail("Field is required!"); 
     55                if ($.isEmpty(value)) { 
     56                    return this.notifyFail("i18n:Field is required!"); 
     57                } 
    5758 
    5859                return this.notifySuccess(); 
     
    6970                if (((this.min != undefined) && value < this.min) || ((this.max != undefined) && value > this.max) 
    7071                        || ((this.step != undefined) && ((value - ((this.min != undefined) ? this.min : 0)) % this.step != 0))) 
    71                     return this.notifyFail("Should be at least {0}, at most {1}, and in steps of {2}!", [ this.min, this.max, 
     72                    return this.notifyFail("i18n:Should be at least {0}, at most {1}, and in steps of {2}!", [ this.min, this.max, 
    7273                            this.step ]); 
    7374 
     
    8485     
    8586                if (((this.min != undefined) && value.length < this.min) || (this.max && value.length > this.max)) 
    86                     return this.notifyFail("Should be longer than {0} and shorter than {1} characters!", [ this.min, this.max ]); 
     87                    return this.notifyFail("i18n:Should be longer than {0} and shorter than {1} characters!", [ this.min, this.max ]); 
    8788     
    8889                return this.notifySuccess(); 
     
    99100 
    100101                if (this.regex.test(value) != true) 
    101                     return this.notifyFail("Not a valid value according to the regex ({0}).", [ this.regex ]); 
     102                    return this.notifyFail("i18n:Not a valid value according to the regex ({0}).", [ this.regex ]); 
    102103             
    103104                return this.notifySuccess(); 
     
    120121             
    121122                if (EMAIL_REGEX.test(value) != true) 
    122                     return this.notifyFail("Not a valid email adress"); 
     123                    return this.notifyFail("i18n:Not a valid email adress"); 
    123124             
    124125                return this.notifySuccess(); 
     
    133134             
    134135                if (URI_REGEX.test(value) != true) 
    135                     return this.notifyFail("Not a valid url"); 
     136                    return this.notifyFail("i18n:Not a valid url"); 
    136137             
    137138                return this.notifySuccess(); 
     
    147148                var options = data.options || [];  
    148149                if ($.valueInArray(value, options) < 0) 
    149                     return this.notifyFail("Value[{0}](@pos {1}) not in list of available options.", [ value, data.index ]); 
     150                    return this.notifyFail("i18n:Value[{0}](@pos {1}) not in list of available options.", [ value, data.index ]); 
    150151             
    151152                return this.notifySuccess(); 
     
    175176                        result = me.notifyFail(response.message, response.args); 
    176177                    else 
    177                         result = me.notifyFail("Remote validation returned incompatible response!"); 
     178                        result = me.notifyFail("i18n:Remote validation returned incompatible response!"); 
    178179                    return result; 
    179180                }; 
    180181                var errorHandler = function() { 
    181182                 
    182                     result = me.notifyFail("Error while connecting to remote validation."); 
     183                    result = me.notifyFail("i18n:Error while connecting to remote validation."); 
    183184                    return result; 
    184185                };