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

Remove BCP-47 APIs from AnyCalendarKind, use CalendarAlgorithm instead #6228

Merged
merged 1 commit into from
Mar 6, 2025

Conversation

robertbastian
Copy link
Member

@robertbastian robertbastian commented Mar 5, 2025

/// Construct from a BCP-47 byte string
///
/// Returns `None` if the calendar is unknown.
pub fn get_for_bcp47_bytes(x: &[u8]) -> Option<Self> {
Copy link
Contributor

Choose a reason for hiding this comment

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

question: is there a valid alternative to use besides get_for_bcp47_bytes and as_bcp47_string?

temporal_rs uses these methods downstream, but maybe there's a better approach to use

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, the API on CalendarAlgorithm. That actually complies with BCP-47, unlike this which fails on islamic-rgsa, and accepts japanext.

Copy link
Contributor

Choose a reason for hiding this comment

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

Perfect! Thanks for the confirmation 😄

At a glance, it looks like it is more aligned, which is nice. Is there any handling for islamicc though? Although, that may be changing with the hijri rename

Copy link
Member Author

Choose a reason for hiding this comment

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

@zbraniecki do preference support aliases?

Comment on lines +937 to +938
Japanese => CalendarAlgorithm::Japanese,
JapaneseExtended => CalendarAlgorithm::Japanese,
Copy link
Member

Choose a reason for hiding this comment

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

Thought: This is lossy.

I guess we can fix this when https://unicode-org.atlassian.net/browse/CLDR-15669 gets implemented.

Copy link
Member Author

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

Yeah, we should fix #4889.

@robertbastian robertbastian marked this pull request as ready for review March 5, 2025 21:40
Copy link
Member

@Manishearth Manishearth left a comment

Choose a reason for hiding this comment

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

Nice, I guess AnyCalendarKind was somewhat of a proto-CalendarAlgorithm preferences but we don't need that complexity anymore

Comment on lines +937 to +938
Japanese => CalendarAlgorithm::Japanese,
JapaneseExtended => CalendarAlgorithm::Japanese,
Copy link
Member

Choose a reason for hiding this comment

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

Yeah, we should fix #4889.

@robertbastian robertbastian merged commit 937749f into unicode-org:main Mar 6, 2025
28 checks passed
@robertbastian robertbastian deleted the calkind branch March 6, 2025 10:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants