Skip to content

Commit

Permalink
CLDR-11018 currency decimal place isn't accurate in the examples
Browse files Browse the repository at this point in the history
See #3975
  • Loading branch information
e-ikwut authored and Squash Bot committed Aug 30, 2024
1 parent ed980db commit e2d9be1
Showing 1 changed file with 9 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@
import org.unicode.cldr.util.ScriptToExemplars;
import org.unicode.cldr.util.SimpleUnicodeSetFormatter;
import org.unicode.cldr.util.SupplementalDataInfo;
import org.unicode.cldr.util.SupplementalDataInfo.CurrencyNumberInfo;
import org.unicode.cldr.util.SupplementalDataInfo.PluralInfo;
import org.unicode.cldr.util.SupplementalDataInfo.PluralInfo.Count;
import org.unicode.cldr.util.SupplementalDataInfo.PluralType;
Expand Down Expand Up @@ -2685,6 +2686,14 @@ private String handleCurrencyFormat(XPathParts parts, String value, boolean show
icuServiceBuilder.getCurrencyFormat(currency, currencySymbol, numberSystem);
df.applyPattern(value);

// getCurrencyFormat sets digits, but applyPattern seems to overwrite it, so fix it again
// here
SupplementalDataInfo supplementalData = CONFIG.getSupplementalDataInfo();
CurrencyNumberInfo info = supplementalData.getCurrencyNumberInfo(currency);
int digits = info.getDigits();
df.setMinimumFractionDigits(digits);
df.setMaximumFractionDigits(digits);

String countValue = parts.getAttributeValue(-1, "count");
if (countValue != null) {
return formatCountDecimal(df, countValue);
Expand Down

0 comments on commit e2d9be1

Please sign in to comment.