# `Cldr.Locale.Loader`
[🔗](https://github.com/elixir-cldr/cldr/blob/v2.47.3/lib/cldr/locale/loader.ex#L1)

Provides a public interface to read the
raw JSON locale files and return the
CLDR data in a consistent format.

The functions in this module are intended for the
use of authors writing additional CLDR-based
libraries.

In addition, the functions in this module are
intended for use at compile-time - not runtime -
since reading, decoding and processing a
locale file is an expensive operation.

# `get_locale`

```elixir
@spec get_locale(
  Cldr.Locale.locale_name(),
  config_or_backend :: Cldr.Config.t() | Cldr.backend()
) ::
  map() | no_return()
```

Read the locale json, decode it and make any necessary transformations.

This is the only place that we read the locale and we only
read it once.  All other uses of locale data are references
to this data.

Additionally the intention is that this is read only at compile time
and used to construct accessor functions in other modules so that
during production run there is no file access or decoding.

# `known_locale_names`

```elixir
@spec known_locale_names(Cldr.Config.t() | Cldr.backend()) :: [
  Cldr.Locale.locale_name()
]
```

Returns a list of all locales that are configured and available
in the CLDR repository.

## Examples

    iex> Cldr.Locale.Loader.known_locale_names %Cldr.Config{locales: ["en", "de"]}
    [:de, :en, :und]

# `known_rbnf_locale_names`

```elixir
@spec known_rbnf_locale_names(Cldr.Config.t()) :: [Cldr.Locale.locale_name()]
```

Returns a list of all locales that have RBNF data and that are
configured and available in the CLDR repository.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
