From 3f41fa1384a01779b2260269dea6d997976ecd9c Mon Sep 17 00:00:00 2001 From: Younies Mahmoud Date: Thu, 27 Jun 2024 16:01:25 +0200 Subject: [PATCH] Implement `PluralCategory` for units displaynames `Count` (#5135) --- .../experimental/src/dimension/provider/units.rs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/components/experimental/src/dimension/provider/units.rs b/components/experimental/src/dimension/provider/units.rs index 7503265acf8..441c694ec27 100644 --- a/components/experimental/src/dimension/provider/units.rs +++ b/components/experimental/src/dimension/provider/units.rs @@ -9,6 +9,7 @@ //! //! Read more about data providers: [`icu_provider`] +use icu_plurals::PluralCategory; use icu_provider::prelude::*; use zerovec::ZeroMap; @@ -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 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, + } + } +}