1 Reply Latest reply on Dec 21, 2007 8:51 AM by andyd273

    Globalization in AIR Flex???

    evsPeart Level 1

      Hi,

      I am doing a AIR application with the new version of Flex Builder, I need to do an application with different languages, like Spanish, English, French and more.

      Where I can see some example and how I can do it? I need to translate labels, title panels, everything dynamically.

      Then the user will choose the language for use the application.

      Regards,
      evspeart
        • 1. Globalization in AIR Flex???
          andyd273
          I don't have any source code, but I can see a way to do it...

          Basically, create a function called ChangeLanguage(PickLang:integer):void that runs on Application creation complete, or with a button push, or whatever.

          Inside of the function create either a select statement or a nested if statement. select would be better, but I can't remember the exact code to do it in AS3, so I'll revert to a PHP psudocode to give you the idea

          switch(PickLang){
          case 1: //english
          Application.Title = "Welcome!";
          break;
          case 2: //french
          Application.Title = "Bonjiour!"; // pardon my french
          break;
          }

          Its a bit clumsy, but it would work.

          The other idea is to store all of the text for the labels in a different XML file for each language. Then do something like the above example to choose between the different bindable xml sources depending on what the user picks. and have the label text feed off of which ever XML file is returned. it would be a lot cleaner code wise... just more complicated with the data handlers. Look up examples for skinning, as that's pretty much what you'll be doing.
          You'll have a french skin, and an english skin, etc...