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

LocalePreferences: bikeshed #5786

Open
sffc opened this issue Nov 6, 2024 · 1 comment
Open

LocalePreferences: bikeshed #5786

sffc opened this issue Nov 6, 2024 · 1 comment
Labels
C-locale Component: Locale identifiers, BCP47 needs-approval One or more stakeholders need to approve proposal

Comments

@sffc
Copy link
Member

sffc commented Nov 6, 2024

LocalePreferences landed in #5729. Two things I want to decide about it before it gets shipped:

  1. Name. Not a big fan of the name. These are not preferences for a locale. It is a locale associated with a preference bag. I think PreferencesLocale is a better name, but would also be happy with naming it "what it is" such as LanguageIdentifierWithRegionExtensions, for example.
  2. Public fields. I don't consider the design of this type 100% finalized. The CLDR spec it is implementing is still a concept, not yet landed in UTS 35. I would prefer it to have private fields. EDIT: Moved to Discuss: Should LocalePreferences have public fields #5785

@zbraniecki @robertbastian

@sffc sffc added C-locale Component: Locale identifiers, BCP47 needs-approval One or more stakeholders need to approve proposal labels Nov 6, 2024
@sffc sffc added this to the ICU4X 2.0 ⟨P1⟩ milestone Nov 6, 2024
@sffc sffc changed the title LocalePreferences: bikeshed and decide on public fields LocalePreferences: bikeshed Nov 6, 2024
@sffc
Copy link
Member Author

sffc commented Nov 7, 2024

  • @zbraniecki To reiterate my reasoning: I don't think there is value of this struct beyond ergonomics of internal operations. For me, it is almost the same as if we listed the field in the main preference bag. These are the "preferences related to locale". I would be opposed to PreferencesLocale because it conveys that this is a type of locale that has value as a standalone struct, but I see the only value is storage of fields and conversion to DataLocale.
  • @sffc OK.
  • @robertbastian I like having the type.
#[non_exhaustive]
pub struct ListFormatterPreferences {
    pub locale_prefs: LocalePreferences,
}
  • @robertbastian The fields of ListFormatterPreferences should be private, right?
  • @sffc You shouldn't ever convert a Locale to a LocalePreferences in user code, because you want to retain other Unicode extensions like numbering system. No strong opinion on the field being public overall
  • @zbraniecki If we make them private, we can make them public later

Conclusion:

  • For naming: keep LocalePreferences.
  • Make the locale_prefs field of preferences bags private.

LGTM: @sffc @zbraniecki @robertbastian

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-locale Component: Locale identifiers, BCP47 needs-approval One or more stakeholders need to approve proposal
Projects
None yet
Development

No branches or pull requests

1 participant