Skip to content

Commit

Permalink
Make ScriptDisplayNames be public (#3317)
Browse files Browse the repository at this point in the history
  • Loading branch information
sffc authored Apr 13, 2023
1 parent 1489105 commit 01039ce
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 19 deletions.
38 changes: 19 additions & 19 deletions experimental/displaynames/src/displaynames.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,25 +84,25 @@ impl RegionDisplayNames {
}
}

// / Lookup of the locale-specific display names by script code.
// /
// / # Example
// /
// / ```
// / use icu_displaynames::{DisplayNamesOptios, ScriptDisplayNames};
// / use icu_locid::{locale, subtags_script as script};
// /
// / let locale = locale!("en-001");
// / let options: DisplayNamesOptions = Default::default();
// / let display_name = ScriptDisplayNames::try_new_unstable(
// / &icu_testdata::unstable(),
// / &locale.into(),
// / options,
// / )
// / .expect("Data should load successfully");
// /
// / assert_eq!(display_name.of(script!("Hant")), Some("United Arab Emirates"));
// / ```
/// Lookup of the locale-specific display names by script code.
///
/// # Example
///
/// ```
/// use icu_displaynames::{DisplayNamesOptions, ScriptDisplayNames};
/// use icu_locid::{locale, subtags_script as script};
///
/// let locale = locale!("en-001");
/// let options: DisplayNamesOptions = Default::default();
/// let display_name = ScriptDisplayNames::try_new_unstable(
/// &icu_testdata::unstable(),
/// &locale.into(),
/// options,
/// )
/// .expect("Data should load successfully");
///
/// assert_eq!(display_name.of(script!("Maya")), Some("Mayan hieroglyphs"));
/// ```
#[derive(Default)]
pub struct ScriptDisplayNames {
options: DisplayNamesOptions,
Expand Down
1 change: 1 addition & 0 deletions experimental/displaynames/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ pub mod provider;
pub use displaynames::LanguageDisplayNames;
pub use displaynames::LocaleDisplayNamesFormatter;
pub use displaynames::RegionDisplayNames;
pub use displaynames::ScriptDisplayNames;
pub use options::DisplayNamesOptions;
pub use options::Fallback;
pub use options::LanguageDisplay;
Expand Down
1 change: 1 addition & 0 deletions provider/datagen/src/transform/cldr/displaynames/script.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ impl IterableDataProvider<ScriptDisplayNamesV1Marker> for crate::DatagenProvider
}

/// Substring used to denote alternative display names data variants for a given script. For example: "BA-alt-short", "TL-alt-variant".
/// TODO(#3316): Distinguish stand-alone ("Traditional Han") from default ("Traditional")
const ALT_SUBSTRING: &str = "-alt-";
/// Substring used to denote short display names data variants for a given script. For example: "az-alt-short".
const ALT_SHORT_SUBSTRING: &str = "-alt-short";
Expand Down

0 comments on commit 01039ce

Please sign in to comment.