# `Localize.Locale.Provider.PersistentTerm`
[🔗](https://github.com/elixir-localize/localize/blob/v0.39.0/lib/localize/locale/provider/persistent_term.ex#L1)

A locale data provider that stores locale data in `:persistent_term`.

This provider loads CLDR locale data from `.etf` files in the
`priv/localize/locales/` directory and caches it in `:persistent_term`
for fast, concurrent access without copying.

# `get`

Retrieves a value from locale data stored in `:persistent_term`.

Navigates the locale data map using the provided list of keys.
When the `:fallback` option is `true` and the key path is not
found, parent locales are searched according to the CLDR locale
inheritance chain.

### Arguments

* `locale` is a locale identifier atom or a `t:Localize.LanguageTag.t/0`.

* `keys` is a list of keys to traverse in the locale data map.

* `options` is a keyword list of options. The default is `[]`.

### Options

* `:fallback` is a boolean. When `true`, parent locales are
  searched if the key path is not found in the requested locale.
  The default is `false`.

### Returns

* `{:ok, value}` if the key path resolves to a value.

* `{:error, reason}` if the key path cannot be resolved.

# `load`

Loads locale data for the given locale.

Locale data is resolved in the following order:

1. If a fresh copy is present in the on-disk cache
   (see `Localize.Locale.Provider.Cache`), it is returned.

2. In `:dev` and `:test` environments, the locale is generated
   from the CLDR source data via
   `Localize.Data.Locale.generate_and_transform/1`.

3. Otherwise, the locale is downloaded via
   `Localize.Locale.Provider.download_locale/1`, written to the
   cache, decoded, and returned.

### Arguments

* `locale` is a locale identifier atom or a `t:Localize.LanguageTag.t/0`.

### Returns

* `{:ok, locale_data}` where `locale_data` is a map of the locale's
  CLDR data.

* `{:error, exception}` if the locale data cannot be obtained.

# `loaded?`

Returns whether locale data has been loaded into `:persistent_term`.

### Arguments

* `locale` is a locale identifier atom or a `t:Localize.LanguageTag.t/0`.

### Returns

* `true` if the locale data is stored in `:persistent_term`.

* `false` otherwise.

# `store`

Stores locale data in `:persistent_term`.

### Arguments

* `locale_id` is a locale identifier atom.

* `locale_data` is a map of locale data to store.

### Returns

* `:ok` on success.

* `{:error, reason}` on failure.

---

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