Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8239395

Accounting currency format support

XMLWordPrintable

    • Icon: CSR CSR
    • Resolution: Withdrawn
    • Icon: P4 P4
    • 11.0.7
    • core-libs
    • None
    • behavioral
    • minimal
    • Hide
      Adding support "cf" changes behavior only if new arguments are supplied.
      Show
      Adding support "cf" changes behavior only if new arguments are supplied.
    • Java API
    • SE

      Summary

      Implement the currency format style Unicode extension defined in LDML.

      Problem

      Currently, the default currency format for the negative amounts simply prepends the minus sign to the amounts with the CLDR locale provider. Since the legacy COMPAT locale provider has been formatting the currency amounts in parentheses in some locales, it is considered a regression in CLDR locale provider.

      Solution

      LDML defines the currency format style extension "cf" which designates the style of the currency formatting. The default style "standard" is used in the JDK which prepends the minus sign to the negative amounts. Alternatively, LDML/CLDR provides currency formats with negative values in parentheses as "accounting" format. By supporting this "accounting" style, applications can use the parentheses style negative amounts with CLDR provider. For this purpose, java.text.NumberFormat#getCurrencyInstance(Locale) will return an appropriate format object based on the given locale's "cf" extension. The default style, i.e., without "cf" extension, will use the "standard" formatting style for the compatibility. Applications that expect the "accounting" style currency formatting will need to specify it explicitly with the locale argument.

      Specification

      Insert the following paragraph in java.text.NumberFormat#getCurrencyInstance(Locale) method description:

       * <p>If the specified locale contains the "{@code cf}" (
       * <a href="https://www.unicode.org/reports/tr35/tr35.html#UnicodeCurrencyFormatIdentifier">
       * currency format style</a>)
       * <a href="../util/Locale.html#def_locale_extension">Unicode extension</a>,
       * the returned currency format uses the style if it is available. 
       * Otherwise, the style uses the default "{@code standard}" currency format.
       * For example, if the style designates "{@code account}", negative
       * currency amounts use a pair of parentheses in some locales. 

            phh Paul Hohensee
            naoto Naoto Sato
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: