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

DateTimeFormatterPreferences #5842

Merged
merged 11 commits into from
Nov 20, 2024
Merged

DateTimeFormatterPreferences #5842

merged 11 commits into from
Nov 20, 2024

Conversation

sffc
Copy link
Member

@sffc sffc commented Nov 20, 2024

@sffc sffc requested review from Manishearth, zbraniecki and a team as code owners November 20, 2024 01:23
@sffc sffc removed the request for review from a team November 20, 2024 01:23
@@ -748,13 +762,13 @@ impl AnyCalendar {
///
/// [📚 Help choosing a constructor](icu_provider::constructors)
#[cfg(feature = "compiled_data")]
pub fn new_for_locale(locale: &DataLocale) -> Self {
let kind = AnyCalendarKind::from_data_locale_with_fallback(locale);
pub fn new_for_locale(prefs: AnyCalendarPreferences) -> Self {
Copy link
Member Author

Choose a reason for hiding this comment

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

Should I rename this function?

Copy link
Member

Choose a reason for hiding this comment

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

I think so - just new?

Copy link
Member Author

@sffc sffc Nov 20, 2024

Choose a reason for hiding this comment

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

@Manishearth What do you think about the name of this function? (a constructor for AnyCalendar)

Note that there are also constructors from AnyCalendarKind.

Copy link
Member

Choose a reason for hiding this comment

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

I like this! Though the locale and prefs is somewhat confusing. But we're going to be reasonably clear that Preferences are a locale-derivable concept so that's fine.

new() is also fine and maaaaybe better?

Copy link
Member Author

Choose a reason for hiding this comment

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

We already have

    #[cfg(feature = "compiled_data")]
    pub const fn new(kind: AnyCalendarKind) -> Self

Copy link
Member

Choose a reason for hiding this comment

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

I'm fine with that being renamed if we need. new_for_kind(kind) vs new(prefs) or new(kind) vs new_for_prefs(prefs)/new_for_locale(prefs)

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 made #5843 to discuss this before 2.0 (but after 2.0 Beta) and unblock this PR

Comment on lines +607 to +608
/// Constructs a [`DataLocale`] for this [`DataMarkerInfo`].
pub fn make_locale(
Copy link
Member Author

Choose a reason for hiding this comment

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

Notice the new function in icu_provider. OK?

zbraniecki
zbraniecki previously approved these changes Nov 20, 2024
Copy link
Member

@zbraniecki zbraniecki left a comment

Choose a reason for hiding this comment

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

this feels so easy to read. Looks great!

@@ -748,13 +762,13 @@ impl AnyCalendar {
///
/// [📚 Help choosing a constructor](icu_provider::constructors)
#[cfg(feature = "compiled_data")]
pub fn new_for_locale(locale: &DataLocale) -> Self {
let kind = AnyCalendarKind::from_data_locale_with_fallback(locale);
pub fn new_for_locale(prefs: AnyCalendarPreferences) -> Self {
Copy link
Member

Choose a reason for hiding this comment

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

I think so - just new?

Manishearth
Manishearth previously approved these changes Nov 20, 2024
zbraniecki
zbraniecki previously approved these changes Nov 20, 2024
AnyCalendarPreferences,
{
/// The user's preferred calendar system.
calendar: CalendarAlgorithm
Copy link
Member

Choose a reason for hiding this comment

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

CalendarSystem?

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 guess I'll stick with the UTS 35 language: "calendar algorithm"

https://unicode.org/reports/tr35/tr35.html#Key_And_Type_Definitions_

Copy link
Member

Choose a reason for hiding this comment

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

spec name works for me.

@sffc sffc dismissed stale reviews from zbraniecki and Manishearth via 8d4815b November 20, 2024 20:39
@sffc sffc merged commit e5ca66d into unicode-org:main Nov 20, 2024
28 checks passed
@sffc sffc deleted the dt-prefs branch November 20, 2024 22:09
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.

3 participants