# `Localize.Number.Symbol`
[🔗](https://github.com/elixir-localize/localize/blob/v1.2.0/lib/localize/number/symbol.ex#L1)

Functions to manage the number symbol definitions for a locale
and number system.

Number symbols define the characters used for decimal separators,
grouping separators, percent signs, and other formatting elements.
Each locale may define symbols for one or more number systems
(e.g., `:latn`, `:arab`, `:thai`).

Symbol data is retrieved at runtime from locale data via the
configured locale provider.

# `t`

```elixir
@type t() :: %Localize.Number.Symbol{
  approximately_sign: String.t(),
  decimal: String.t() | map(),
  exponential: String.t(),
  group: String.t() | map(),
  infinity: String.t(),
  list: String.t(),
  minus_sign: String.t(),
  nan: String.t(),
  per_mille: String.t(),
  percent_sign: String.t(),
  plus_sign: String.t(),
  superscripting_exponent: String.t(),
  time_separator: String.t()
}
```

# `number_symbols_for`

```elixir
@spec number_symbols_for(Localize.LanguageTag.t() | atom() | String.t()) ::
  {:ok, map()} | {:error, Exception.t()}
```

Returns a map of `Localize.Number.Symbol.t()` structs of the
number symbols for each number system of a locale.

### Arguments

* `locale` is a locale identifier atom, string, or a
  `t:Localize.LanguageTag.t/0` struct.

### Returns

* `{:ok, symbols_map}` where `symbols_map` is a map of
  `%{system_name => Localize.Number.Symbol.t()}`.

* `{:error, exception}` if the locale data cannot be loaded.

### Examples

    iex> {:ok, symbols} = Localize.Number.Symbol.number_symbols_for(:en)
    iex> symbols[:latn].decimal
    %{standard: "."}

# `number_symbols_for`

```elixir
@spec number_symbols_for(
  Localize.LanguageTag.t() | atom() | String.t(),
  atom() | String.t()
) ::
  {:ok, t()} | {:error, Exception.t()}
```

Returns the number symbols for a specific locale and number system.

### Arguments

* `locale` is a locale identifier atom, string, or a
  `t:Localize.LanguageTag.t/0` struct.

* `number_system` is a number system name atom or string
  (e.g., `:latn`, `:arab`).

### Returns

* `{:ok, Localize.Number.Symbol.t()}` with the symbols for the
  requested number system.

* `{:error, exception}` if the locale data cannot be loaded or
  no symbols exist for the number system.

When the requested number system has no symbol data of its own in
the locale, the symbols of the locale's default number system are
returned. This mirrors CLDR inheritance, where root aliases every
other numbering system's symbols to `latn`, and is what makes a
`-u-nu-` override such as `en-u-nu-thai` formattable.

### Examples

    iex> {:ok, symbols} = Localize.Number.Symbol.number_symbols_for(:en, :latn)
    iex> symbols.percent_sign
    "%"
    iex> symbols.group
    %{standard: ","}

---

*Consult [api-reference.md](api-reference.md) for complete listing*
