4 Replies Latest reply on Apr 11, 2008 9:24 AM by riesvantwisk

    Replacement dot with comma

    ElLamok
      Recently, I tryed to change default number formating. For example, when i want to display something like 1/2 as Number, i'll get 0.5. And this is ok, but scientific standarts demand on comma.
      Therefore, I want ask: How could one change default number representation without using NumberFormating and others. I thought about locale, but there no params for it, just default decimal separators for NumberFormater.

      Thanks a lot forward.
        • 1. Re: Replacement dot with comma
          Gregory Lafrance Level 6
          You can affect the default decimal separator by changing the decimal separator properties in this file:
          C:\Program Files\Adobe\Flex Builder 2\Flex SDK 2\frameworks\locale\en_US\SharedResources.properties

          Of course this will make the change in all areas of all your Flex apps, and you will need to rebuild the framework_rb.swc file. This is for FB2.0.1, so may be different for FB3.
          • 2. Re: Replacement dot with comma
            riesvantwisk
            You can also put a SharedResourcs in your own locale directory for example
            locale/en_US/SharedResources.properties
            locale/nl_NL/SharedResources.properties
            etc.....

            I currently drilled it down to the following files:

            // this is used for dates
            formatters.properties

            // this is used for numbers and stuff
            SharedResources.properties
            validators.properties

            But depending on how you compile your swf you need to tell the compiler to included these files. This way you can make your project specific for a locale (or number of locales).

            Ries
            • 3. Re: Replacement dot with comma
              ElLamok Level 1
              Thats mean, that i should use method "format" of different formaters, such as NumberFormatter, CurrencyFormatter and others. Can i just change somewhere decimal separator, may be add some arguments to a compiler and get comma instead of dot without manually formating values?

              Greg, in your explanation, I could change just a defult value for separators, when i call the corresponding methods
              • 4. Re: Replacement dot with comma
                riesvantwisk Level 1
                ElLamok,
                you can also set the decimal separator directly on the formatter if you like.

                However this is just much more work for programs that need to function in several locales. Eater way works ofcourse...


                Ries