Locale-derived display data for number form inputs.
Returns the decimal/grouping separator characters, the active number system, and the locale's minus sign — everything a JS hook needs to render a number in the user's locale.
All locale lookups go through Localize.validate_locale/1;
the resulting Localize.LanguageTag.t/0's
:cldr_locale_id is the canonical id reported back. Number
system resolution goes through
Localize.Number.System.number_system_from_locale/1 so
Arabic-Indic, Persian, and other non-Latin digit systems work
out of the box.
Summary
Types
Locale display data resolved by number_for_locale/1.
Functions
Resolves display data for the given locale.
Types
@type t() :: %Localize.Inputs.Number.Symbols{ decimal: String.t(), group: String.t(), language_tag: Localize.LanguageTag.t(), locale: atom(), minus_sign: String.t(), number_system: atom() }
Locale display data resolved by number_for_locale/1.
:locale— the canonical CLDR locale id (atom).:language_tag— the fullLocalize.LanguageTag.t/0.:number_system— the active number system (:latn,:arab,:arabext, …).:decimal— the locale's decimal separator character.:group— the locale's grouping separator character.:minus_sign— the locale's minus sign character.
Functions
@spec number_for_locale(Localize.LanguageTag.t() | atom() | String.t() | nil) :: {:ok, t()} | {:error, Exception.t()}
Resolves display data for the given locale.
Arguments
localeis a locale identifier (atom, string, orLocalize.LanguageTag.t/0). Defaults toLocalize.get_locale/0.
Returns
{:ok, t()}on success.{:error, Exception.t()}when the locale can't be parsed (Localize.InvalidLocaleError), the number system can't be resolved, or no symbols are available (Localize.Inputs.Number.NoNumberSymbolsError).
Examples
iex> {:ok, info} = Localize.Inputs.Number.Symbols.number_for_locale(:en)
iex> {info.decimal, info.group, info.number_system}
{".", ",", :latn}
iex> {:ok, info} = Localize.Inputs.Number.Symbols.number_for_locale(:de)
iex> {info.decimal, info.group}
{",", "."}