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

Make locale_prefs private #5955

Closed

Conversation

Manishearth
Copy link
Member

@Manishearth Manishearth commented Jan 6, 2025

Uses doc(hidden) accessors for getting/setting

Fixes #5786

@Manishearth Manishearth force-pushed the locale-prefs-private branch from f128ee1 to d5b01cb Compare January 6, 2025 20:05
@Manishearth
Copy link
Member Author

---- tools/md-tests/src/lib.rs - tutorials::data_provider_md (line 23) stdout ----
error[E0616]: field `locale_prefs` of struct `icu_provider::hello_world::HelloWorldFormatterPreferences` is private
  --> tools/md-tests/src/lib.rs:64:79
   |
43 |     let loc = DataLocale::from_preferences_locale::<HelloWorldV1Marker>(prefs.locale_prefs);
   |                                                                               ^^^^^^^^^^^^ private field
---- components/datetime/src/neo.rs - neo::DateTimeFormatterPreferences (line 39) stdout ----
error[E0616]: field `locale_prefs` of struct `DateTimeFormatterPreferences` is private
  --> components/datetime/src/neo.rs:49:8
   |
12 | prefs2.locale_prefs.language = Language::try_from_str("fr").unwrap();
   |        ^^^^^^^^^^^^ private field

error: aborting due to 1 previous error

For more information about this error, try `rustc --explain E0616`.
Couldn't compile the test.

What should we do about this?

@sffc
Copy link
Member

sffc commented Jan 6, 2025

This is for #5785

As far as DataLocale goes, we said:

  • DataLocale moves to icu_locale_core::DataLocale
  • LocalePreferences has two conversion functions into a DataLocale: to_data_locale_language_priority(self), to_data_locale_region_priority(self)
  • DataLocale gets private fields

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.

LocalePreferences: bikeshed
3 participants