Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement LongCurrencyFormatter for Long Currency Formatting #5351

Merged
merged 18 commits into from
Aug 26, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,10 @@ impl<'l> Writeable for LongFormattedCurrency<'l> {
let pattern = patterns
.get(&pattern_count)
.or_else(|| patterns.get(&PatternCount::Other))
.ok_or(core::fmt::Error)?;
// According to [Unicode Technical Standard #35](https://unicode.org/reports/tr35/tr35-numbers.html),
// The `other` pattern must be present in the data.
// Also, if the `other` pattern is not present, the datagen will fail.
.unwrap();

// TODO: Remove this line once the pattern is already implemented in the provider.
// Parse the pattern string into a DoublePlaceholderPattern
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 2 additions & 3 deletions provider/data/experimental/fingerprints.csv
Original file line number Diff line number Diff line change
Expand Up @@ -29347,15 +29347,14 @@ currency/extended@1, zu/YER, 68B, 52c541c97403eaa6
currency/extended@1, zu/ZAR, 75B, 854159a2eeed4880
currency/extended@1, zu/ZMK, 85B, f9b17cba085ca192
currency/extended@1, zu/ZMW, 71B, 608ab48db3a48aad
currency/patterns@1, <lookup>, 94B, 14 identifiers
currency/patterns@1, <total>, 617B, 9 unique payloads
currency/patterns@1, <lookup>, 91B, 13 identifiers
currency/patterns@1, <total>, 569B, 8 unique payloads
currency/patterns@1, blo, 82B, da128faf13fad0d5
currency/patterns@1, ceb, 72B, db7c7c84fecaf3d0
currency/patterns@1, es-GT, 72B, -> ceb
currency/patterns@1, ja, 61B, 9af35aad6ebc7d70
currency/patterns@1, my, 62B, 86cee97085536d8b
currency/patterns@1, ro, 85B, 629b2b7dcea97875
currency/patterns@1, sd, 48B, 3a6d9523170345d0
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this seems to be a CLDR bug (missing Other), can you file an issue?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have already filed this issue: #5374. I want to discuss it with @sffc today to ensure that it is a CLDR issue before filing it. If it is a CLDR issue, we need to decide what to do in the meantime. We can use the default {0} {1} or the pattern from en-US.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

currency/patterns@1, si, 71B, 4f661a4fd0c9c312
currency/patterns@1, sw, 72B, -> ceb
currency/patterns@1, to, 62B, -> my
Expand Down
6 changes: 6 additions & 0 deletions provider/source/src/currency/patterns.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,12 @@ impl DataProvider<CurrencyPatternsDataV1Marker> for SourceDataProvider {
.get(default_system)
.ok_or(DataErrorKind::IdentifierNotFound.into_error())?;

// According to [Unicode Technical Standard #35](https://unicode.org/reports/tr35/tr35-numbers.html),
// The `other` pattern must be present in the data.
if patterns.pattern_other.is_none() {
return Err(DataErrorKind::IdentifierNotFound.into_error());
}

Ok(DataResponse {
metadata: Default::default(),
payload: DataPayload::from_owned(CurrencyPatternsDataV1 {
Expand Down