Cldr.Number.Format.Options (Cldr Numbers v2.35.0)

View Source

Functions to validate and transform options that guide number formatting

Summary

Types

currency_symbol()

@type currency_symbol() :: :standard | :iso | :narrow | :symbol | :none

fixed_format()

@type fixed_format() :: :standard | :currency | :accounting | :short | :long

format()

@type format() :: binary() | fixed_format()

separators()

@type separators() :: :standard | :us

short_format_style()

@type short_format_style() ::
  :currency_short
  | :currency_long
  | :currency_long_with_symbol
  | :decimal_short
  | :decimal_long

t()

@type t() :: %Cldr.Number.Format.Options{
  currency: Cldr.Currency.t() | :from_locale,
  currency_digits: pos_integer(),
  currency_format: :currency | :accounting,
  currency_spacing: map(),
  currency_symbol: term(),
  format: format(),
  fractional_digits: pos_integer(),
  locale: Cldr.LanguageTag.t(),
  maximum_integer_digits: pos_integer(),
  minimum_grouping_digits: pos_integer(),
  number_system: Cldr.Number.System.system_name(),
  pattern: String.t(),
  round_nearest: pos_integer(),
  rounding_mode: Decimal.rounding(),
  separators: separators(),
  symbols: Cldr.Number.Symbol.t(),
  wrapper: (String.t(), atom() -> String.t())
}

Functions

standard_format(formats, format, locale, number_system, backend)

validate_options(number, backend, options)

@spec validate_options(Cldr.Math.number_or_decimal(), Cldr.backend(), [
  {atom(), term()}
]) ::
  {:ok, t()} | {:error, {module(), String.t()}}