Cldr Numbers v0.3.1 Cldr.Number.Symbol View Source

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

Link to this section Summary

Functions

Returns a list of the number symbols for all number systems of a locale

Returns the number sysbols for a specific locale and number system

Link to this section Functions

Link to this function number_symbols_for(locale \\ Cldr.get_current_locale()) View Source
number_symbols_for(Cldr.LanguageTag.t()) :: Keyword.t()

Returns a list of the number symbols for all number systems of a locale.

  • locale is any locale known to Cldr. See Cldr.known_locales().

Example:

iex> Symbol.number_symbols_for(Cldr.Locale.new("th"))
[latn: %{decimal: ".", exponential: "E", group: ",", infinity: "∞", list: ";",
   minus_sign: "-", nan: "NaN", per_mille: "‰", percent_sign: "%",
   plus_sign: "+", superscripting_exponent: "×", time_separator: ":"},
 thai: %{decimal: ".", exponential: "E", group: ",", infinity: "∞", list: ";",
   minus_sign: "-", nan: "NaN", per_mille: "‰", percent_sign: "%",
   plus_sign: "+", superscripting_exponent: "×", time_separator: ":"}]
Link to this function number_symbols_for(locale, number_system) View Source
number_symbols_for(Cldr.LanguageTag.t(), atom() | binary()) ::
  {:ok, Map.t()} |
  {:no_symbols, String.t()} |
  {:error, String.t()}

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

  • locale is any locale known to Cldr. See Cldr.known_locales().

  • number_system which defaults to :default and is either:

    • an atom in which case it is interpreted as a number system type in the given locale. Typically this would be either :default or :native. See Cldr.Number.Format.format_types_for/1 for the number system types available for a given locale.

    • a binary in which case it is used to look up the number system directly (for exmple "latn" which is common for western european languages). See Cldr.Number.Format.formats_for/1 for the available formats for a locale.

Example

iex> Cldr.Number.Symbol.number_symbols_for(Cldr.Locale.new("th"), "thai")
%{decimal: ".", exponential: "E", group: ",", infinity: "∞", list: ";",
  minus_sign: "-", nan: "NaN", per_mille: "‰", percent_sign: "%",
  plus_sign: "+", superscripting_exponent: "×", time_separator: ":"}