Summary
Clarify missing Locale Unicode extension behavior for NumberFormat and DecimalFormatSymbols.
Problem
DecimalFormatSymbols does not define the behavior when multiple Unicode extension key/values are used together. Additionally, DecimalFormatSymbols does not make apparent that "cu" can override the currency.
NumberFormat does not define the "cu" extension under its Locale Extension section which should list all applicable extensions.
Solution
For DecimalFormatSymbols, define the priority of the extensions in the existing class description section which already mentions the "rg" extension.
For NumberFormat, add an entry to the Locale Extensions section for "cu" (Currency Type).
Specification
In the class description of DecimalFormatSymbols,
- * <p>If the locale contains "rg" (region override)
- * <a href="../util/Locale.html#def_locale_extension">Unicode extension</a>,
- * the symbols are overridden for the designated region.
+ * <p>The "rg" (region override), "nu" (numbering system), and "cu" (currency)
+ * {@code Locale} <a href="../util/Locale.html#def_locale_extension">Unicode
+ * extensions</a> are supported which may override values within the symbols.
+ * For both "nu" and "cu", if they are specified in addition to "rg" by the
+ * backing {@code Locale}, the respective values from the "nu" and "cu" extension
+ * supersede the implicit ones from the "rg" extension.
In the Locale Extensions section in the class description of NumberFormat,
+ * <li> "cu"
+ * (<a href="https://www.unicode.org/reports/tr35/tr35.html#UnicodeCurrencyIdentifier">
+ * Currency Type</a>) - Overrides the Currency used
* </ul>
* <p>
- * If both "nu" and "rg" are specified, the decimal digits from the "nu"
- * extension supersedes the implicit one from the "rg" extension.
+ * For both "nu" and "cu", if they are specified in addition to "rg", the respective
+ * values from the "nu" and "cu" extension supersede the implicit ones from the "rg" extension.
- csr of
-
JDK-8364780 Unicode extension clarifications for NumberFormat/DecimalFormatSymbols
-
- Resolved
-