feat(currency): Introduce try_new_code constructor#8229
Open
younies wants to merge 2 commits into
Open
Conversation
Separate symbol mappings (placeholders, pattern configurations, and default pattern selection) into a dedicated CurrencySymbolsV1 marker and struct (symbols.rs), leaving CurrencyEssentialsV1 purely for core layout rules (patterns and indices). - Create CurrencySymbolsV1 with pattern_config_map, placeholders, and default_pattern_config in components/experimental/src/dimension/provider/currency/symbols.rs. - Extract CurrencySymbolsV1 in provider/source/src/currency/symbols.rs from CLDR (symbol and symbol-narrow). - Update CurrencyEssentialsV1 in essentials.rs to only retain patterns and indices. - Update CurrencyFormatterData::Essential and formatters in formatter.rs & compact_formatter.rs to require and use both CurrencyEssentialsV1 and CurrencySymbolsV1. - Update provider registry (provider/registry/src/lib.rs) and regenerate test and baked data for CurrencySymbolsV1 and CurrencyEssentialsV1. TAG=agy CONV=d044eeab-1ec7-4391-9cf0-a6d3d9e6edf0
2c83b9a to
9416f65
Compare
Introduce try_new_code constructor for formatting with 3-letter ISO currency codes (e.g. USD, EUR) without requiring the CurrencySymbolsV1 data payload. - Add CurrencyFormatterData::Code variant holding only CurrencyEssentialsV1 and CurrencyCode. - Implement try_new_code constructor (with macro-generated buffer constructors and try_new_code_unstable) requiring only DataProvider<CurrencyEssentialsV1>. - Update format_fixed_decimal to format Code variants using the ISO code and standard_alpha_next_to_number_pattern. - Add test_code in format.rs verifying ISO code formatting behavior. - Add --locked to cargo-rdme installation in tools/make/tidy.toml to fix CI tidy builds. TAG=agy CONV=d044eeab-1ec7-4391-9cf0-a6d3d9e6edf0
9416f65 to
2498c10
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.
Introduce
try_new_codeconstructor for formatting with 3-letter ISO currency codes (e.g.USD,EUR) without requiring theCurrencySymbolsV1data payload.Note: Stacked on top of #8228 (
split-essential).CI Fix Note: Updated
tools/make/tidy.tomlto pass--lockedwhen runningcargo install --version 1.5.1 cargo-rdme. Without--locked, Cargo resolves the newest compatible dependencies from crates.io and pulls inkstring v2.0.3(which requiresrustc 1.96.0), causing the CItidyjob onrustc 1.95.0to fail. Passing--lockedusescargo-rdme v1.5.1's pinned lockfile (kstring v2.0.2), restoring clean builds underrustc 1.95.0.CurrencyFormatterData::Codevariant holding onlyCurrencyEssentialsV1andCurrencyCode.try_new_codeconstructor (with macro-generated buffer constructors andtry_new_code_unstable) requiring onlyDataProvider<CurrencyEssentialsV1>.format_fixed_decimalto formatCodevariants using the ISO code andstandard_alpha_next_to_number_pattern.test_codeinformat.rsverifying ISO code formatting behavior.--lockedtocargo-rdmeinstallation intools/make/tidy.toml.Changelog
try_new_codeconstructor for formatting with 3-letter ISO currency codes without requiringCurrencySymbolsV1.tidyjob by passing--lockedwhen installingcargo-rdme.TAG=agy
CONV=d044eeab-1ec7-4391-9cf0-a6d3d9e6edf0