Skip to content

Commit

Permalink
CLDR-11018 currency decimal place isn't accurate in the examples (#3975)
Browse files Browse the repository at this point in the history
  • Loading branch information
e-ikwut authored Oct 4, 2024
1 parent ce677ad commit 00e1fc2
Showing 1 changed file with 9 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,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 @@ -2740,6 +2741,14 @@ private void handleCurrencyFormat(
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) {
examples.add(formatCountDecimal(df, countValue));
Expand Down

0 comments on commit 00e1fc2

Please sign in to comment.