MyApp.Cldr.Number.System.system_name_from

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

system_name_from(system_name, locale)

View Source

Specs

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

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

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> MyApp.Cldr.Number.System.system_name_from(:default, "en")
{:ok, :latn}

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

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

iex> MyApp.Cldr.Number.System.system_name_from(:nope, "en")
{
  :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.