From e2d9be1fdec6e79203ea889ec515a2ec49e34bfe Mon Sep 17 00:00:00 2001 From: Emiyare Ikwut-Ukwa Date: Fri, 30 Aug 2024 15:31:36 +0000 Subject: [PATCH] CLDR-11018 currency decimal place isn't accurate in the examples See #3975 --- .../java/org/unicode/cldr/test/ExampleGenerator.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tools/cldr-code/src/main/java/org/unicode/cldr/test/ExampleGenerator.java b/tools/cldr-code/src/main/java/org/unicode/cldr/test/ExampleGenerator.java index 913e4884462..c6edf2a1dbf 100644 --- a/tools/cldr-code/src/main/java/org/unicode/cldr/test/ExampleGenerator.java +++ b/tools/cldr-code/src/main/java/org/unicode/cldr/test/ExampleGenerator.java @@ -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; @@ -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);