Changeset 5201

Show
Ignore:
Timestamp:
08/09/06 01:24:37 (2 years ago)
Author:
peller
Message:

i18n for ValidationTextbox?, Spinner widgets

Location:
trunk/src/widget
Files:
2 added
4 modified

Legend:

Unmodified
Added
Removed
  • trunk/src/widget/Spinner.js

    r5197 r5201  
    218218 
    219219                postMixInProperties: function(args, frag){ 
     220                        this.inherited("postMixInProperties"); 
     221 
    220222                        // set image size before instantiating template; 
    221223                        // changing it aftwards doesn't work on FF 
  • trunk/src/widget/templates/Spinner.html

    r5163 r5201  
    1818                        </td> 
    1919                </tr> 
    20         </table><!-- 
    21         --><span dojoAttachPoint='invalidSpan' class='${this.invalidClass}'>${this.invalidMessage}</span><!-- 
    22         --><span dojoAttachPoint='missingSpan' class='${this.missingClass}'>${this.missingMessage}</span><!-- 
    23         --><span dojoAttachPoint='rangeSpan' class='${this.rangeClass}'>${this.rangeMessage}</span><!-- 
    24 --></span> 
     20        </table> 
     21        <span dojoAttachPoint='invalidSpan' class='${this.invalidClass}'>${this.messages.invalidMessage}</span> 
     22        <span dojoAttachPoint='missingSpan' class='${this.missingClass}'>${this.messages.missingMessage}</span> 
     23        <span dojoAttachPoint='rangeSpan' class='${this.rangeClass}'>${this.messages.rangeMessage}</span> 
     24</span> 
  • trunk/src/widget/templates/ValidationTextbox.html

    r5044 r5201  
    33                id='${this.widgetId}' name='${this.name}' size='${this.size}' maxlength='${this.maxlength}' 
    44                value='${this.value}' class='${this.className}' style=''> 
    5         <span dojoAttachPoint='invalidSpan' class='${this.invalidClass}'>${this.invalidMessage}</span> 
    6         <span dojoAttachPoint='missingSpan' class='${this.missingClass}'>${this.missingMessage}</span> 
    7         <span dojoAttachPoint='rangeSpan' class='${this.rangeClass}'>${this.rangeMessage}</span> 
     5        <span dojoAttachPoint='invalidSpan' class='${this.invalidClass}'>${this.messages.invalidMessage}</span> 
     6        <span dojoAttachPoint='missingSpan' class='${this.missingClass}'>${this.messages.missingMessage}</span> 
     7        <span dojoAttachPoint='rangeSpan' class='${this.rangeClass}'>${this.messages.rangeMessage}</span> 
    88</span> 
  • trunk/src/widget/validate.js

    r5121 r5201  
    66dojo.require("dojo.widget.Parse"); 
    77dojo.require("dojo.xml.Parse"); 
    8 dojo.require("dojo.lang"); 
     8dojo.require("dojo.lang.array"); 
     9dojo.require("dojo.lang.common"); 
    910 
    1011dojo.require("dojo.validate.common"); 
     
    1314dojo.require("dojo.validate.web"); 
    1415dojo.require("dojo.validate.us"); 
     16 
     17dojo.require("dojo.i18n.common"); 
     18dojo.requireLocalization("dojo.widget", "validate"); 
    1519 
    1620dojo.widget.manager.registerWidgetPackage("dojo.widget.validate"); 
     
    138142                maxlength: "", 
    139143                promptMessage: "", 
    140                 invalidMessage: "* The value entered is not valid.", 
    141                 missingMessage: "* This value is required.", 
    142                 rangeMessage: "* This value out of range.", 
     144                invalidMessage: "", 
     145                missingMessage: "", 
     146                rangeMessage: "", 
    143147                listenOnKeyPress: true, 
    144148                htmlfloat: "none", 
     
    234238                        } 
    235239                }, 
     240 
     241                postMixInProperties: function(localProperties, frag) { 
     242                        dojo.widget.validate.ValidationTextbox.superclass.postMixInProperties.apply(this, arguments); 
     243                        this.messages = dojo.i18n.getLocalization("dojo.widget", "validate"); 
     244                        dojo.lang.forEach(["invalidMessage", "missingMessage", "rangeMessage"], function(prop) { 
     245                                if(this[prop]){ this.messages[prop] = this[prop]; } 
     246                        }, this); 
     247                }, 
    236248         
    237249                // FIXME: why are there to fillInTemplate methods defined here? 
     
    370382  Has 5 new properties that can be specified as attributes in the markup. 
    371383 
    372   @attr cents      The two decimal places for cents.  Can be true or false, optional if omitted. 
     384  @attr fractional      The decimal places (e.g. for cents).  Can be true or false, optional if omitted. 
    373385  @attr symbol     A currency symbol such as Yen "???", Pound "???", or the Euro "???". Default is "$". 
    374386  @attr separator  Default is "," instead of no separator as in IntegerTextbox. 
     
    385397         
    386398                        // Get properties from markup attributes, and assign to flags object. 
    387                         if ( localProperties.cents ) {  
    388                                 this.flags.cents = ( localProperties.cents == "true" ); 
     399                        if ( localProperties.fractional ) {  
     400                                this.flags.fractional = ( localProperties.fractional == "true" ); 
     401                        } else if ( localProperties.cents ) { 
     402                                dojo.deprecated("dojo.widget.validate.IntegerTextbox", "use fractional attr instead of cents", "0.5"); 
     403                                this.flags.fractional = ( localProperties.cents == "true" ); 
    389404                        } 
    390405                        if ( localProperties.symbol ) {