experimental/currency: Drive monetary grouping entirely by currencyFormats data, making CurrencyEssentialsV1 a numbering-system-attributed marker#8052
Draft
younies wants to merge 1 commit into
Conversation
…rmats data, making CurrencyEssentialsV1 a numbering-system-attributed marker - icu_decimal: Add DecimalFormatter::try_new_from_payloads constructor and allow affix symbols in DecimalSubPattern extractions. - CurrencyEssentialsV1: Add attributes_domain = "numbering_system" and embed DecimalSymbols struct. - Datagen: Extract monetary grouping sizes and localized separator symbols for requested numbering systems. - CurrencyFormatter: Remove DecimalSymbolsV1 trait bound and implement two-step attribute fallback loading.
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.
Changelog
Current
CurrencyFormattershared the un-attributedDecimalSymbolsV1data payload with standard decimal formatting. This forced monetary values to use standard decimal grouping sizes rather than the explicit monetary grouping pattern defined incurrencyFormats("¤#,##0.00").This PR completely decouples currency formatters from standard decimal format dependencies and transforms
CurrencyEssentialsV1into a pristine numbering-system-attributed marker:1. Decimal Formatter Modularity (
icu_decimal)DecimalFormatter::try_new_from_payloadsconstructor allowing external components to instantiate internal decimal formatters directly from pre-resolved data payloads.DecimalSubPattern::try_from_itemsto correctly accept affix symbol items (Currency,Percent,PlusSign,MinusSign) inside prefixes and suffixes.2. Attributed Provider Data (
CurrencyEssentialsV1)attributes_domain = "numbering_system"toCurrencyEssentialsV1data marker.pub decimal_symbols: DecimalSymbols<'data>directly insideCurrencyEssentials.extract_currency_essentials) to dynamically grab symbols and patterns for the exact requested numbering system attribute (e.g.,arabforar-EG) rather than hardcodinglatn.primary_groupingandsecondary_groupingsizes directly fromcurrencyFormats.standard.3. Formatter Wiring (
CurrencyFormatter)DataProvider<icu_decimal::provider::DecimalSymbolsV1>from the trait bounds oftry_new_unstable!essentialdata viamap_project.prefs.numbering_system), gracefully falling back to the un-attributed default entry if omitted.try_new) to load digits directly fromicu_decimal::provider::Baked.