You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@poi.apache.org by PJ Fanning <fa...@yahoo.com.INVALID> on 2022/02/03 14:32:57 UTC

dollar function is very locale specific

I accidentally ran into https://bz.apache.org/bugzilla/show_bug.cgi?id=62857. The existing implementation was way off. I implemented the US locale support but to support all locales will be a lot of work.

The output is very locale specific. https://docs.microsoft.com/en-us/globalization/locale/currency-formatting gives an idea but only spells out the behaviour for a very small number of locales.

My current implementation will use the currency symbol associated with the LocaleUtil user locale and the group and decimal separators for that locale.

What it doesn't do is:
* put the currency symbol at the end for locales that prefer that way
* it currently puts parentheses around negative numbers but this is US specific (possibly some more locales too) - and when you use the negative sign instead, it can appear before or after the currency symbol (if that symbol appears before the number)

I'll probably just create a follow up issue that I'll leave up to someone else to do - as I have little interest in researching and implementing the solution for every possible locale. 

If someone knows of something that is already hidden away in the existing POI number formatting code, I might have a look. Any pointers would be appreciated.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org