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

Add datetime API for loading length patterns, sitting on top of semantic skeleta #5162

Open
sffc opened this issue Jul 1, 2024 · 5 comments
Labels
C-datetime Component: datetime, calendars, time zones U-ecma402 User: ECMA-402 compatibility

Comments

@sffc
Copy link
Member

sffc commented Jul 1, 2024

CLDR issue: https://unicode-org.atlassian.net/browse/CLDR-17775

Semantic skeleta allow a lot of flexibility for locales to select the fields most relevant for their formatting.

However, they produce different output than date length patterns since the backing CLDR data is different.

For 2.0, I suggest moving forward with something like this:

use icu::datetime::{YearMonthDay, CldrDateStyle, Length};

// Semantic Skeleta data
icu::datetime::Formatter::<YearMonthDay>::try_new(locale.into(), Length::Short)

// CLDR Length Pattern data
icu::datetime::Formatter::<CldrDateStyle>::try_new(locale.into(), Length::Short)

This way, in 2.0, we nudge users toward semantic skeleta, but we give an escape hatch for using the CLDR date length data, which is well signaled.

Thoughts? @eggrobin @zbraniecki

@sffc sffc added C-datetime Component: datetime, calendars, time zones needs-approval One or more stakeholders need to approve proposal labels Jul 1, 2024
@sffc sffc added this to the ICU4X 2.0 ⟨P1⟩ milestone Jul 1, 2024
@sffc
Copy link
Member Author

sffc commented Jul 23, 2024

What I want to do for 2.0:

  • Keep both YearMonthDay and Auto styles
  • Rename Auto to CldrLength or similar; possibly keep it behind an experimental feature? Delete it if/when CLDR decides to properly consolidate it.

@sffc sffc removed the needs-approval One or more stakeholders need to approve proposal label Jul 23, 2024
@sffc sffc self-assigned this Jul 23, 2024
@sffc
Copy link
Member Author

sffc commented Sep 17, 2024

The LDML spec doesn't include CldrStyle so I would like to remove it.

@zbraniecki to post more info / screenshots.

@sffc sffc added the needs-approval One or more stakeholders need to approve proposal label Sep 17, 2024
@zbraniecki
Copy link
Member

This is what's in Windows 10:

This is MacOS:

(based on tc39/ecma402#109 )

I think the trend is to simplify it, as I don't have access to latest Windows, but on latest MacOS I can't find the same UI in my Settings.

@sffc
Copy link
Member Author

sffc commented Sep 20, 2024

OK, got it, this is just about the OS override stuff?

I think the right design is to implement this in a thin wrapper that sits on top of icu::datetime::Formatter. I'd be fine having that be in the crate as a first-class supported abstraction.

I'm going to repurpose this issue and remove it from the 2.0 milestone.

@sffc sffc changed the title Date Length and Semantic Skeleta define two ways to do the same thing Add datetime API for loading length patterns, sitting on top of semantic skeleta Sep 20, 2024
@sffc sffc added U-ecma402 User: ECMA-402 compatibility and removed needs-approval One or more stakeholders need to approve proposal labels Sep 20, 2024
@sffc sffc unassigned zbraniecki and sffc Sep 20, 2024
@sffc
Copy link
Member Author

sffc commented Sep 26, 2024

Discussed with @zbraniecki. It is solvable via either the higher-level type in ICU4X or in userland, so this doesn't need to block 2.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-datetime Component: datetime, calendars, time zones U-ecma402 User: ECMA-402 compatibility
Projects
None yet
Development

No branches or pull requests

2 participants