feat(currency): Add accounting formatting and relax constructor validation#8177
Open
younies wants to merge 9 commits into
Open
feat(currency): Add accounting formatting and relax constructor validation#8177younies wants to merge 9 commits into
younies wants to merge 9 commits into
Conversation
983286a to
7420977
Compare
younies
added a commit
to younies/icu4x
that referenced
this pull request
Jul 5, 2026
7420977 to
38c8dbf
Compare
younies
added a commit
to younies/icu4x
that referenced
this pull request
Jul 5, 2026
38c8dbf to
48b5344
Compare
younies
added a commit
to younies/icu4x
that referenced
this pull request
Jul 5, 2026
48b5344 to
e0dac35
Compare
younies
added a commit
to younies/icu4x
that referenced
this pull request
Jul 5, 2026
e0dac35 to
085f6cb
Compare
younies
added a commit
to younies/icu4x
that referenced
this pull request
Jul 6, 2026
085f6cb to
371a6fe
Compare
younies
added a commit
to younies/icu4x
that referenced
this pull request
Jul 6, 2026
371a6fe to
00e4244
Compare
younies
added a commit
to younies/icu4x
that referenced
this pull request
Jul 6, 2026
00e4244 to
ebd85e7
Compare
younies
added a commit
to younies/icu4x
that referenced
this pull request
Jul 6, 2026
ebd85e7 to
e59f92c
Compare
younies
added a commit
to younies/icu4x
that referenced
this pull request
Jul 6, 2026
e59f92c to
de33b9b
Compare
younies
added a commit
to younies/icu4x
that referenced
this pull request
Jul 6, 2026
de33b9b to
84608eb
Compare
…mat_sign logic Extract the common format_sign logic from the match arms in format_fixed_decimal to avoid duplication, as suggested in PR review. TAG=agy CONV=b42e69df-8afe-401b-aedf-7af6a5c30a76
Document that `u8::MAX` is used as a sentinel value in `standard_fractions_index` and `standard_next_to_alpha_fractions_index` when the precision matches the default, and the formatter should fall back to the default currency fractions. TAG=agy CONV=7e0f7c07-a527-44f4-8ebe-270520b5881c
84608eb to
e68dc25
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR addresses what was left in #8066 and adds support for accounting currency formatting.
Changelog
CurrencyFormatterandCompactCurrencyFormatterconstructors that required the standard pattern to be present. This allows the formatters to initialize and rely on runtime fallback.Accountingvariant toCurrencyUsageenum.CurrencyEssentials::name_and_patternto retrieve accounting patterns (accounting_positive,accounting_negative, etc.) whenCurrencyUsage::Accountingis selected.self.options.usagetoname_and_pattern.standard_patternto returnFALLBACK_PATTERN("{0} {1}") if the pattern is missing (due to corrupt data), with adebug_assert!in debug builds.&DoublePlaceholderPattern.accounting_alpha_next_to_number_positivetostandard_alpha_next_to_number.format.rs.FALLBACK_PATTERNinessentials.rs.Diff Base:
currency-plural-patterns(which is stacked oncurrency-cash-formatting#8175)TAG=agy
CONV=f08dbbb0-24e0-4da6-a2f8-f6a19ba2c8b5