icu4x
icu4x copied to clipboard
Create data provider for an ideal components bag
Closes #1318
This follows the Provider data format JSON as closely as possible.
There's a lot of work to be done still, but I'm opening a draft to seek for some comments on the structure of the provider.
Some thoughts:
- Would be good to have a concept of a generic
Pattern(not to be confused withGenericPattern) restricted to a subset ofFieldSymbols. That way, e.g.year_month_daycould be restricted to aPatternwith only theYear,MonthandDaysymbols, which should make parsing a bit easier. preferred_hour_cycleis already provided by the current version of CLDR, right?time_zoneis still a WIP, since I'm not sure what should be the underlying data needed for that.- Is there a need for
gluein time formats? - Always open for better name proposals 😅
- The proposed JSON includes "mixed" patterns with format fields + placeholders. I'm creating an entirely new pattern struct to handle this, but there's a possibility of unifying
Pattern,GenericPatternand this newMixedPatternin a single struct.
cc @zbraniecki
Suggestion: Maybe do this in a way that we can use MixedPatternItem also for regular PatternItem so we don't have so much code duplication. PatternItem doesn't need
Placeholder(u8). If it encounters one at runtime, it can either error out or substitute some other token in its place.
I think MixedPatternItem is more akin to GenericPatternItem than to PatternItem, since it should eventually support something like the GenericPattern::combined operation. Also, I have some ideas on how to simplify some of the code to reduce duplication :)
Notice: the branch changed across the force-push!
- Cargo.lock is different
- components/datetime/src/pattern/item/mixed.rs is different
- components/datetime/src/pattern/reference/display.rs is different
- components/datetime/src/pattern/runtime/mixed.rs is different
- provider/datagen/Cargo.toml is different
~ Your Friendly Jira-GitHub PR Checker Bot