Cldr.default_locale

You're seeing just the function default_locale, go back to Cldr module for more information.

Returns the configured global default locale.

The default locale can be set with Cldr.put_default_locale/1.

Alternatively the default locale may be configured in config.exs under the ex_cldr key as follows:

config :ex_cldr,
  default_locale: <locale_name>

Returns

  • The default locale or

  • Raises an exception if no default backend is configured

Notes

Cldr.default_locale/0 returns the system-wide default locale.

Example

iex> Cldr.default_locale
%Cldr.LanguageTag{
  backend: TestBackend.Cldr,
  canonical_locale_name: "en-Latn-001",
  cldr_locale_name: "en-001",
  language_subtags: [],
  extensions: %{},
  gettext_locale_name: "en",
  language: "en",
  locale: %{},
  private_use: [],
  rbnf_locale_name: "en",
  requested_locale_name: "en-001",
  script: "Latn",
  territory: :"001",
  transform: %{},
  language_variant: nil
}

Specs

default_locale(backend()) :: Cldr.LanguageTag.t()

Returns the global default locale for a given backend.

Arguments

  • backend is any module that includes use Cldr and therefore is a Cldr backend module

Returns

  • The default locale for the backend

Example

iex> Cldr.default_locale(TestBackend.Cldr)
%Cldr.LanguageTag{
  backend: TestBackend.Cldr,
  canonical_locale_name: "en-Latn-001",
  cldr_locale_name: "en-001",
  language_subtags: [],
  extensions: %{},
  gettext_locale_name: "en",
  language: "en",
  locale: %{},
  private_use: [],
  rbnf_locale_name: "en",
  requested_locale_name: "en-001",
  script: "Latn",
  territory: :"001",
  transform: %{},
  language_variant: nil
}