Skip to content

Commit 4a6d1f2

Browse files
Add conversions for properties/locale scripts (#7270)
#4705
1 parent 8d06c0e commit 4a6d1f2

File tree

2 files changed

+20
-2
lines changed

2 files changed

+20
-2
lines changed

components/properties/src/bidi.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,6 @@ pub enum BidiPairedBracketType {
7171
#[cfg(feature = "unicode_bidi")]
7272
use crate::props::BidiClass;
7373

74-
/// Implements [`unicode_bidi::BidiDataSource`] on [`CodePointMapDataBorrowed<BidiClass>`](crate::CodePointMapDataBorrowed).
75-
///
7674
/// ✨ *Enabled with the `unicode_bidi` Cargo feature.*
7775
///
7876
/// # Examples

components/properties/src/props.rs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -905,6 +905,26 @@ impl Script {
905905
pub const Chisoi: Script = Self(254);
906906
}
907907

908+
/// ✨ *Enabled with the `compiled_data` Cargo feature.*
909+
#[cfg(feature = "compiled_data")]
910+
impl From<Script> for icu_locale_core::subtags::Script {
911+
fn from(value: Script) -> Self {
912+
crate::PropertyNamesShort::new()
913+
.get_locale_script(value)
914+
.unwrap_or(icu_locale_core::subtags::script!("Zzzz"))
915+
}
916+
}
917+
918+
/// ✨ *Enabled with the `compiled_data` Cargo feature.*
919+
#[cfg(feature = "compiled_data")]
920+
impl From<icu_locale_core::subtags::Script> for Script {
921+
fn from(value: icu_locale_core::subtags::Script) -> Self {
922+
crate::PropertyParser::new()
923+
.get_strict(value.as_str())
924+
.unwrap_or(Self::Unknown)
925+
}
926+
}
927+
908928
make_enumerated_property! {
909929
name: "Script";
910930
short_name: "sc";

0 commit comments

Comments
 (0)