Cldr.Number.System.system_name_from

You're seeing just the function system_name_from, go back to Cldr.Number.System module for more information.
Link to this function

system_name_from(system_name, locale, backend)

View Source

Specs

system_name_from(
  system_name(),
  Cldr.Locale.locale_name() | Cldr.LanguageTag.t(),
  Cldr.backend()
) :: {:ok, atom()} | {:error, {module(), String.t()}}

Returns a number system name for a given locale and number system reference.

Arguments

Notes

Number systems can be references in one of two ways:

  • As a number system type such as :default, :native, :traditional and :finance. This allows references to a number system for a locale in a consistent fashion for a given use

  • WIth the number system name directly, such as :latn, :arab or any of the other 70 or so

This function dereferences the supplied system_name and returns the actual system name.

Examples

ex> Cldr.Number.System.system_name_from(:default, "en", TestBackend.Cldr)
{:ok, :latn}

iex> Cldr.Number.System.system_name_from("latn", "en", TestBackend.Cldr)
{:ok, :latn}

iex> Cldr.Number.System.system_name_from(:native, "en", TestBackend.Cldr)
{:ok, :latn}

iex> Cldr.Number.System.system_name_from(:nope, "en", TestBackend.Cldr)
{
  :error,
  {Cldr.UnknownNumberSystemError, "The number system :nope is unknown"}
}

Note that return value is not guaranteed to be a valid number system for the given locale as demonstrated in the third example.