PluralRules.ordinal constructor

PluralRules.ordinal(
  1. DataProvider provider,
  2. Locale locale
)

Construct an `PluralRules` for the given locale, for ordinal numbers

See the Rust documentation for try_new_ordinal for more information.

Throws DataError on failure.

Implementation

factory PluralRules.ordinal(DataProvider provider, Locale locale) {
  final result = _icu4x_PluralRules_create_ordinal_mv1(provider._ffi, locale._ffi);
  if (!result.isOk) {
    throw DataError.values[result.union.err];
  }
  return PluralRules._fromFfi(result.union.ok, []);
}