Skip to content

Commit

Permalink
Add an essential comments for the currency patterns datagen. (#5332)
Browse files Browse the repository at this point in the history
  • Loading branch information
younies authored Aug 7, 2024
1 parent 03382fc commit 54ff78c
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions provider/source/src/currency/patterns.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@ impl DataProvider<CurrencyPatternsDataV1Marker> for SourceDataProvider {
Ok(DataResponse {
metadata: Default::default(),
payload: DataPayload::from_owned(CurrencyPatternsDataV1 {
// TODO(#5334):
// Before graduating the currency crate,
// Check that the .json data files are completed and no need to fallback chain up to the root.
unit_patterns: ZeroMap::from_iter(
[
(PatternCount::Zero, patterns.pattern_zero.as_deref()),
Expand All @@ -57,6 +60,10 @@ impl DataProvider<CurrencyPatternsDataV1Marker> for SourceDataProvider {
.into_iter()
.filter_map(|(count, pattern)| match (count, pattern) {
(PatternCount::Other, pattern) => Some((count, pattern?)),
// NOTE:
// According to [Unicode Technical Standard #35](https://unicode.org/reports/tr35/tr35-numbers.html),
// if a specific count is not available, the `other` pattern should be used.
// Therefore, if the pattern is equal to the `other` pattern, we should not include it in the map.
(_, pattern) if pattern == patterns.pattern_other.as_deref() => None,
_ => Some((count, pattern?)),
}),
Expand Down

0 comments on commit 54ff78c

Please sign in to comment.