Details

      Description

      I have an web application used by users with different locales.

      BeanUtils doesn't provide processing conversion according to given locale.

      We need to convert numbers, dates according to user locale. For example, some users must have possibility to enter numbers with comma as decimal delimiter. In opposite English users must have possibility to enter numbers with point as decimal delimiter.

        Activity

        Hide
        Siarhei added a comment -

        LocaleConvertUtils provides useful methods to convert string values to objects of the specified class.

        But they doesn't provide a general mechanism to perform conversion like LocaleBeanUtils does.

        I think it would be good to have a class providing conversion interface which allows specification of locale to use.

        For example it would be nice to have the following method in LocaleBeanUtils:

        public static void populate(java.lang.Object bean, java.util.Map properties, java.util.Locale locale )

        Show
        Siarhei added a comment - LocaleConvertUtils provides useful methods to convert string values to objects of the specified class. But they doesn't provide a general mechanism to perform conversion like LocaleBeanUtils does. I think it would be good to have a class providing conversion interface which allows specification of locale to use. For example it would be nice to have the following method in LocaleBeanUtils: public static void populate(java.lang.Object bean, java.util.Map properties, java.util.Locale locale )
        Hide
        Niall Pemberton added a comment -
        Show
        Niall Pemberton added a comment - My mistake I should have said LocaleConvertUtils: http://commons.apache.org/beanutils/apidocs/org/apache/commons/beanutils/locale/LocaleConvertUtils.html
        Hide
        Siarhei added a comment -

        I think, LocaleBeanUtils does this for one locale per application. Your can have only English locale or only French locale or only German locale to perform convert.

        Our situation is different. We have multi-threaded application where we need several locale-dependent converters: English, French, German. Our users have locale-dependent data they pass to web-application with their locale indicator. We need to use to convert strings to double, date according to user locale rules.

        We can't switch default locale of LocaleBeanUtils by call of LocaleBeanUtils.setDefaultLocale( locale ) each time we have to make locale-dependent convert for different locale.

        Show
        Siarhei added a comment - I think, LocaleBeanUtils does this for one locale per application. Your can have only English locale or only French locale or only German locale to perform convert. Our situation is different. We have multi-threaded application where we need several locale-dependent converters: English, French, German. Our users have locale-dependent data they pass to web-application with their locale indicator. We need to use to convert strings to double, date according to user locale rules. We can't switch default locale of LocaleBeanUtils by call of LocaleBeanUtils.setDefaultLocale( locale ) each time we have to make locale-dependent convert for different locale.
        Hide
        Niall Pemberton added a comment -

        LocaleBeanUtils does this - though I've not used it and am not convinced the quality of that code is that good.

        Show
        Niall Pemberton added a comment - LocaleBeanUtils does this - though I've not used it and am not convinced the quality of that code is that good.

          People

          • Assignee:
            Unassigned
            Reporter:
            Siarhei
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:

              Development