Expand description
UTS 35 classical datetime skeletons.
Semantic skeletons (field sets) use classical skeletons for pattern matching in datagen.
See Skeleton
and Bag
for more information.
✨ Enabled with the datagen
Cargo feature.
§Implementation status
This is currently only a partial implementation of the UTS-35 skeleton matching algorithm.
Algorithm step | Status |
---|---|
Match skeleton fields according to a ranking | Implemented |
Adjust the matched pattern to have certain widths | Implemented |
Match date and times separately, and them combine them | Implemented |
Use appendItems to fill in a pattern with missing fields | Not yet, and may not be fully implemented. See issue #586 |
§Description
A [components::Bag
] is a model of encoding information on how to format date
and time by specifying a list of components the user wants to be visible in the formatted string
and how each field should be displayed.
This model closely corresponds to ECMA402
API and allows for high level of customization
compared to Length
model.
Additionally, the bag contains an optional set of Preferences
which represent user
preferred adjustments that can be applied onto the pattern right before formatting.
§Pattern Selection
The [components::Bag
] is a way for the developer to describe which components
should be included in in a datetime, and how they should be displayed. There is not a strict
guarantee in how the final date will be displayed to the end user. The user’s preferences and
locale information can override the developer preferences.
The fields in the [components::Bag
] are matched against available patterns in
the CLDR
locale data. A best fit is found, and presented to the user. This means that in
certain situations, and component combinations, fields will not have a match, or the match will
have a different type of presentation for a given locale.
Modules§
- Reference
Skeleton
implementation for parsing. - Runtime
Skeleton
implementation for more efficient deserialization.
Structs§
- A collection of plural variants of a pattern.
Enums§
- The best skeleton found, alongside information on how well it matches.
- Either a
Pattern
single pattern or aPluralPattern
collection of patterns when there are plural variants. - These strings follow the recommendations for the serde::de::Unexpected::Other type. https://docs.serde.rs/serde/de/enum.Unexpected.html#variant.Other
Functions§
- Given a set of fields (which represents a skeleton), try to create a best localized pattern
- A partial implementation of the UTS 35 skeleton matching algorithm.