Test JDK: jdk 14 build 11
Run following code with -Djava.locale.providers=CLDR:
public static void main(String[] args) {
String langTag = "zh-CN-u-nu-arab-cf-account";
NumberFormat cf = NumberFormat.getCurrencyInstance(Locale.forLanguageTag(langTag));
String output = cf.format(-1234);
System.out.println("zh-CN-u-nu-arab-cf-account: " + output);
langTag = "ar-SA-u-cf-account";
cf = NumberFormat.getCurrencyInstance(Locale.forLanguageTag(langTag));
output = cf.format(-1234);
System.out.println("ar-SA-u-cf-account: " + output);
}
Output: Parentheses for negative currency amounts. Please refer to attachment result.jpg.
Expect: Default minus sign for negative currency amounts.
When with CLDR provider specified, for locale "zh-CN-u-nu-arab-cf-account", "zh_CN" is not supported by CLDR, it falls back to the language only CLDR locale resource (zh.xml)
In CLDR zh.xml:
<currencyFormats numberSystem="arab">
<currencyFormatLength>
<currencyFormat type="standard">
<pattern>��#,##0.00</pattern>
</currencyFormat>
<currencyFormat type="accounting">
<pattern draft="contributed">��#,##0.00</pattern>
</currencyFormat>
</currencyFormatLength>
</currencyFormats>
Under currencyFormats with "arab" numberSystem, it does not have a explicit pattern for negative currency amounts, my understanding is it should use a minus sign as a default, not a parentheses.
For locale "ar-SA-u-cf-account", in CLDR ar-SA.xml, no currencyFormats with "arab" numberSystem, based on the CLDR fallback mechanism, it should also use a minus sign as a default.