On Dec 10, 4:18 pm, Kimloan Ho <[EMAIL PROTECTED]> wrote:
> Hi,
> I start working on the story #69 "Move configuration
> of default currency value from DB to config file." I
> have a question about the display format of a double
> to represent an amount of money. The format of the
> double number is supposed to match the configured
> locale or the configured currency?
[...]
Interesting question! I did a couple of quick searches and was unable
to find any industry standards for say, displaying an amount of US
dollars and cents when the current locale is fr_FR.
I tried formatting USD 1,234.56 as a French (France) currency in
OpenOffice.org Calc, and it displayed:
1,234.56 EURO
(that last symbol is the Euro symbol in case it didn't show up in this
post). I noted that the en_US convention of decimal formatting was
used (comma as the thousands separator and period for the decimal
point), and a Euro symbol was just tacked on the end.
When I try formatting some amount of Euros in Java for fr_FR, it
appears to use the fr_FR decimal formatting as well as the Euro
symbol. For example:
import java.text.NumberFormat;
import java.util.Locale;
class NFmt {
public static void main(String args[]) {
NumberFormat nf =
NumberFormat.getCurrencyInstance(Locale.FRANCE);
String fmttt = nf.format(1234.56);
System.out.println(fmttt);
}
}
It prints out:
1 234,56 EURO
The thousands separator is some strange character... Vim tells me it
is 0x00a0. UNICODE space character, maybe?
Anyway, the other test I tried is to print out USD 1,234.56 while in
the fr_FR locale, and I did this by removing the argument in the call
to getCurrencyInstance(), then executing the class like so:
$ LANG=fr_FR java NFmt
But that just printed out
$1,234.56
Hrmm, that doesn't seem right to me... I'd expect that the fr_FR
thousands separator and decimal point should be used.
So the behavior of Calc, my inconclusive tests, and information in the
Java Tutorial on customizing formats for numbers and currencies
( http://java.sun.com/docs/books/tutorial/i18n/format/decimalFormat.html
) leads me to suspect the industry standard for displaying a monetary
value of a different currency might just be whatever the user wants.
I'm curious to see what the PMs suggest.
This relevant Developerworks article might also be helpful:
http://www.ibm.com/developerworks/java/library/j-mer08133/
HTH,
-Adam
--
Adam Monsen
-------------------------------------------------------------------------
SF.Net email is sponsored by:
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services
for just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
_______________________________________________
Mifos-functional mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mifos-functional