Skip to content

Commit

Permalink
Implement PluralCategory for units displaynames Count (#5135)
Browse files Browse the repository at this point in the history
  • Loading branch information
younies authored Jun 27, 2024
1 parent e298617 commit 3f41fa1
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions components/experimental/src/dimension/provider/units.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
//!
//! Read more about data providers: [`icu_provider`]
use icu_plurals::PluralCategory;
use icu_provider::prelude::*;
use zerovec::ZeroMap;

Expand Down Expand Up @@ -74,3 +75,17 @@ pub enum Count {
// NOTE(egg): No explicit 0, because the compact decimal pattern selection
// algorithm does not allow such a thing to arise.
}

impl From<PluralCategory> for Count {
fn from(other: PluralCategory) -> Self {
use PluralCategory::*;
match other {
Zero => Count::Zero,
One => Count::One,
Two => Count::Two,
Few => Count::Few,
Many => Count::Many,
Other => Count::Other,
}
}
}

0 comments on commit 3f41fa1

Please sign in to comment.