6 Replies Latest reply on Jul 13, 2007 3:09 AM by mikeSibbald

    going global

      My company is currently getting ready to try and release software around the world...the problem is how to i change the laungague that appears on the screen...obviously i could have seperate xml files for each laungage but i would like to try and avoid that...I have read somewhere about resource bundles but i am not sure how to use them...If someone has any idea on how to accomplish this or can explain a resource bundle to me or something to help me out that would be great...

      P.S. i would like to let everyone know that since i started using flex this fourm has been one of best resources for any launguage i have used so thanks to everyone who has helped and who will help me in the future...

      Thanks again
        • 1. Re: going global
          Gboro54 Level 1
          Does anyone have any ideas to help me with this??? I could reallys use the help with this
          • 2. Re: going global
            cluebcke Level 1
            First off, read "Localizing Flex Applications" in the Flex Developer's Guide. It explains the ResourceBundle implementation in Flex. To put it very simply (but don't take this as a substitute for reading the docs):

            1. You create /locale/ subfolders for each locale (e.g. en_US for US English, fr_CN for Canadian French, etc)
            2. In each folder you place a set of .properties files containing the appropriately translated text
            3. You add metadata tags in your application code, associating the files with ResourceBundle classes
            4. You use the -locale (I think, check the doc) compiler option to compile one version of your app for each locale

            It's the last step that's kind of a gotcha for some folks (like me). Some people are using this framework and loving it; others have rolled their own to support run-time loading of resources. Run-time loading will be incorporated with Flex 3, but until then, if you either need to avoid creating or serving one SWF for each locale, or if you need to switch locales at runtime, you'll need to implement your own solution.

            Keep in mind that you probably need to deal with dates, currencies and number formats as well. I had a very informative exchange with Gordon Smith from the Flex team on flexcoders

            Last thing: If you implement your own, I would recommend sticking as closely as possible to the Flex implementation pattern so you can adopt the run-time loading in Flex 3 without too much trouble. This also includes formatting resource bundle files as simple property sheets (name=value pairs), rather than XML--I agree that XML is too heavy handed for such a simple structure, and it's easy to build a property sheet parser in AS3.

            Hope that helps,
            • 3. Re: going global
              Gboro54 Level 1
              where do i plae this /locale/subfolders for each language??? and does anyone have any sample .property folders for these that i could see so i know what is going on a little better thanks for all the help again
              • 4. Re: going global
                chris.luebcke Level 1
                Again, you really need to read the chapter in the developer's guide on localization. That will answer your questions about where resource files can go. (Short answer, anywhere in your classpath, but you probably want to put them under a common locale folder).

                Check in the flex-sdk /frameworks/locale folder for examples; these are the resources that the framework itself uses.

                - Chris
                • 5. Re: going global
                  Gboro54 Level 1
                  thanks for all your help...