Number Format Heaven

Well here’s a happy ending ……. I have a working solution to this hell.

I did not try any of the solutions I wrote up in the comments of the hell post. I just woke up the next morning realising it was even simpler.

The solution to getting Cocoon and Dojo using the same localised formats for numbers, was to use Java classes that are built using the same CLDR data as Dojo.

I now use the NumberFormat classes from instead of java.text, to send and receive formatted numbers. It was almost a drop-in replacement.

The IBM versions have their format data compiled from the same source as Dojo. While java.text.*’s data seems to be really stale.

Choose the version that uses the same CLDR version as Dojo.
Dojo 1.1.1 uses CLDR 1.5.1 so wants icu4j version 3.8.1 and Dojo 1.2 will use CLDR 1.6 which comes in icu4j 4.0 (so there is a clear upgrade path).

Here’s one happy bunny.

The one remaining fly in the ointment is languages like Hindi and Arabic, that use different Unicode characters for digits, which is really ironic as supposedly zero came from India and the 1 to 9 came from Arabia, (imagine trying to do maths with Roman numerals!!) probably the next thing to try is re-building Dojo’s locale number libraries with everything included.