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

Accounting currency format support

    Details

    • Type: CSR
    • Status: Closed
    • Priority: P4
    • Resolution: Approved
    • Fix Version/s: 14
    • Component/s: core-libs
    • Labels:
      None
    • Subcomponent:
    • Compatibility Kind:
      behavioral
    • Compatibility Risk:
      minimal
    • Compatibility Risk Description:
      Adding support "cf" changes behavior only if new arguments are supplied.
    • Interface Kind:
      Java API
    • Scope:
      SE

      Description

      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. 

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                naoto Naoto Sato
                Reporter:
                naoto Naoto Sato
                Reviewed By:
                Roger Riggs
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: