3 Replies Latest reply on Aug 18, 2009 11:13 PM by msakrejda

    localization in flex

    cosmits

      Hi All

       

      i'm looking for a solution for localizing a web-application to enable multiple languages for the user to pick from

      i went through the formal Adobe solution, which is using resource bundles and the resourceManager

      which is fine for simple strings, but for more complex applications

      it raises very significant questions:

       

      1 - how does one 'inject' data variables in a sentence - for example - "my car has X doors and can reach xxx  xx per hour"

           in different languages with different grammar, those variables need to be located differently within the sentence,

           there for i can't just translate the text in between...

      2 - it may have different strings depending on the data, single or plural nouns depending on data quantities...

          for example - "I wish I had X extra window/windows in my office" ...

       

       

      these problems are addressed in other languages as the standard 'gettext()' solution, you can search 'poedit' to get more info

       

      did anyone found a way to use 'poedit' / 'gettext' / po / mo files   within a flex application?

      did i miss by any chance those featurs in the use of resource bundles and the resourceManager in flex?

       

      i would really appreciate a response

      thank you for your time

       

      c

       

        • 1. Re: localization in flex
          Eli7BBB Level 1

          Hi,

          I am not sure if you already have found a solution. Any way my 2 cents....

           

          Unfortunately, one cannot use the gettext solution in action script.

           

          What we did was to add an event listener for the change of language,

          The places in the application which are written differently in each language,

          had a listener for the change of language.

           

          Then I used a switch statement which constructed the correct sentence

          based on the current chosen langauge.

           

          Eli7

          • 3. Re: localization in flex
            msakrejda Level 4

            IResourceManager.getString() does parameter interpolation: e.g., you can have an en_US resource like

             

            "My car has {0} doors and can reach {1} miles per hour"

             

            and another (lt_PG) resource like

             

            "My arcay ancay eachray {1} ilesmay erpay ourhay anday ashay {0} oorsday"

             

            and call

             

            ResourceManager.getInstance().getString('my_bundle', 'car_string', [ 5, 20 ], 'en_US')

            ResourceManager.getInstance().getString('my_bundle', 'car_string', [ 5, 20 ], 'lt_PG')

             

            and get the right answer for both.

             

            I don't know if you have any flexibility in when to allow switching locales, but if you do, you may want to try to restrict it to login only. This has made our lives much simpler. After all, it's probably not very often that a customer decides, "Well, en_US has been working great for the past half hour, but now I think I'd like to give jp_JP a go for a while."

             

            --
            Maciek Sakrejda
            Truviso, Inc.
            www.truviso.com
            Truviso is hiring: http://www.truviso.com/company-careers.php?i=87