1 Reply Latest reply on Aug 23, 2010 3:32 AM by Flex don

    DateField and localization issue

    snafu7x7

      This is a weird one...I have a form with several fields I am localizing according to the language the user selects froma drop down (which sets the current locale). I have a resource bundle for each language I am using (currently just English (en_US) and French (fr_CA)) and it works perfectly swapping out all the copy. For the DateFields you need to specify the format for the date as well as the text to use for the month names and days of the week, like this:

       

      <mx:DateField id="dcDOB" yearNavigationEnabled="true"  width="150"
         formatString="{ResourceManager.getInstance().getString('resources', 'formatString')}"
         dayNames="{ResourceManager.getInstance().getStringArray('resources', 'dayNames')}"
         monthNames="{ResourceManager.getInstance().getStringArray('resources', 'monthNames')}" />

       

      and my RB values look like this

       

      dayNames=D,L,M,M,J,V,S
      monthNames=Janvier,Fevrier,Mars,Avril,Mai,Juin,Juillet,Août,Septembre,Octobre,Novembre,Déc embre
      formatString=DD/MM/YYYY

       

      This works 'mostly' correct as the calendar pops up and correctly displays the localized text from my resoruce bundle but it also displays the text 'null' twice next to the month name (see attached) when using French (but not English). Does anyone know what might be causing this? Am I forgetting to set something on the component or is this a bug or what?

       

      calendar.jpg

        • 1. Re: DateField and localization issue
          Flex don

          Hi friend,

           

          This is a common mistake that most of us make. Its a simple property, that we miss to set every time when localizing from english to some other language.

           

          Simply set the two properties monthSymbol="" and yearSymbol="" to avoid the null getting appended after the month and year. Because these properties default values are null.

           

          Hope it helps.

          kannan. R