I have a GWT project in which I need to manually specify currency, number and datetime formats. These customizations include specifying the currency symbols, grouping seperator, decimal seperator, negative number formats etc. What would be the best way to accomplish this?
Should I use the GWT NumberFormat class? NumberFormat makes extensive use of the GWT internationalization constructs like the Constants interface etc. If you therefore specify a custom number format mask, it will still look at the current locale and use those monetary symbols, decimal symol and thousand separators, as is specified in the late-bound and internationalized 'NumberFormat' instance.
My question is: how would you accomplish this? Would you re-implement NumberFormat
's functionality? Would you derive from it and use the protected constructor and pass it in some kind of custom NumberConstant
s instance that you created yourself? How about getting the i18n NumberConstants instance, and using that to populate your own instance and override only what you want?
How would you approach this problem?