<i18n dev> Currency updates in JDK 7

Stephen Colebourne scolebourne at joda.org
Mon Aug 24 13:53:07 PDT 2009


Naoto Sato wrote:
> Stephen Colebourne wrote:
>> Unfortunately, not all currencies are associated with countries. Some,
>> like XAG for 'silver', XDR for 'IMF drawing rights' or XXX for 'no
>> currency' have no matching country. Thus, this file format is unable
>> to represent user overrides to those countries.
> 
> You meant "those currencies" here, right?  If that's the case, yes it is 
> true.  We might need these currencies be updated in this properties file 
> by enhancing the file format, however, the frequency for those 
> currencies being updated is much less than the ones associated with 
> particular countries.

Yes, thats what I meant. For the new Joda-Money I used this file format:
EUR,978,2,IEFRESPTFIBENLLUDEATITMTSKSIGRCYADMCMESMVA
FJD,242,2,FJ
FKP,238,2,FK
GBP,826,2,GBIMJEGGGSIO
XAG,961,-1,

The last column are the two letter country codes that the currency is 
applicable for (blank means pseduo curency).

> Right now, there is no mechanism to update the ISO-3166 country codes in 
> the JRE.  So even though the format itself is capable of accepting any 
> (new or old) country codes, it does not work for new ISO-3166 country 
> codes.

Thats unfortunate.

>> I believe that we should also consider if Currency should implement
>> Comparable, sorting alphabetically on the currency code. While there
>> are many possible sort orders, having this as the default one makes a
>> lot of sense.
> 
> Having the class Comparable makes sense to me.  Although the default may 
> be arguable (ISO-3166 code has numeric values independent of the three 
> letter codes).
> 
>> Finally, I'd like to see a method isPsuedoCurrency() added. This would
>> return a boolean indicating if the currency is 'real' or not.
> 
> This one is also nice to have.

I also reckon that a method to get the country codes that the currency 
is valid for would be useful:

Set<String> getApplicableCountryCodes()

Stephen


More information about the i18n-dev mailing list