LocaleDisplayNamesFormatter constructor

LocaleDisplayNamesFormatter(
  1. Locale locale,
  2. DisplayNamesOptions options
)

Creates a new LocaleDisplayNamesFormatter from locale data and an options bag using compiled data.

See the Rust documentation for try_new for more information.

Throws DataError on failure.

Implementation

factory LocaleDisplayNamesFormatter(Locale locale, DisplayNamesOptions options) {
  final temp = _FinalizedArena();
  final result = _icu4x_LocaleDisplayNamesFormatter_create_v1_mv1(locale._ffi, options._toFfi(temp.arena));
  if (!result.isOk) {
    throw DataError.values[result.union.err];
  }
  return LocaleDisplayNamesFormatter._fromFfi(result.union.ok, []);
}