Skip navigation
nam1490
Currently Being Moderated

Localization

Feb 24, 2012 5:27 AM

I am trying to localize my application.i have used flex 3.4 and my application is air.and i am unable to use localization.can any any one tell me what i am missing in the following code?

 

 

my property file is---

en_US/RegistrationForm.properties

registration_title=Registration

submit_button=Submit Form

personname=Name

street_address=Street Address

city=City

 

and my actionscript file is--

<?xml version="1.0"?>

<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">

          <mx:Script>

 

 

                    <![CDATA[

                              import mx.controls.Alert;

                              import mx.resources.ResourceBundle;

                    ]]>

 

          </mx:Script>

          <mx:Form>

                    <mx:FormItem label="{resourceManager.getString('RegistrationForm','registration_ti tle')}">

                              <mx:TextInput/>

                    </mx:FormItem>

                    <mx:FormItem label="{resourceManager.getString('RegistrationForm','submit_button') }">

                    <mx:TextInput/>

                    </mx:FormItem>

                    <mx:FormItem label="{resourceManager.getString('RegistrationForm','personname')}">

                    <mx:TextInput/>

                    </mx:FormItem>

                              <mx:FormItem label="{resourceManager.getString('RegistrationForm','street_address' )}">

                    <mx:TextInput/>

                    </mx:FormItem>

                                        <mx:FormItem label="{resourceManager.getString('RegistrationForm','city')}">

                    <mx:TextInput/>

                    </mx:FormItem>

          </mx:Form>

</mx:Application>

 

Also i have set additional compiler argument as  -locale=en_US;

please suggest any way.

thanx in advance.

 
Replies
  • Currently Being Moderated
    Feb 24, 2012 10:21 AM   in reply to nam1490

    Inside <mx:Application>, add

     

    <mx:Metadata>

        [ResourceBundle("RegistrationForm")]

    </mx:Metadata>

     

    This tells the compiler that your application class uses a resource bundle named RegistrationForm. Without this metadata, the compiler won't understand that it also needs to compile your RegistrationForm.properties file. It's not smart enough to figure this out by looking at parameters of ResourceManager methods inside databinding expressions.

     

    Gordon Smith, Adobe

     
    |
    Mark as:
  • Currently Being Moderated
    Feb 27, 2012 10:30 AM   in reply to nam1490

    Assuming that the source directory for your .mxml, .as, and .css files is C:\myapp\src and the en_US version of RegistrationForm.properties is in the directory C:\myapp\locale\en_US, then you should be specifying -source-path=C:\myapp\src,C:\myapp\locale\{locale}. And there should be no need to specify -allow-source-path-overlap=true; in general, you should avoid overlapping source paths.

     

    Gordon Smith, Adobe

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points