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.
Summary
Functions
Retrieves a value from locale data stored in :persistent_term.
Loads locale data for the given locale.
Returns whether locale data has been loaded into :persistent_term.
Stores locale data in :persistent_term.
Functions
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
localeis a locale identifier atom or aLocalize.LanguageTag.t/0.keysis a list of keys to traverse in the locale data map.optionsis a keyword list of options. The default is[].
Options
:fallbackis a boolean. Whentrue, parent locales are searched if the key path is not found in the requested locale. The default isfalse.
Returns
{:ok, value}if the key path resolves to a value.{:error, reason}if the key path cannot be resolved.
Loads locale data for the given locale.
Locale data is resolved in the following order:
If a fresh copy is present in the on-disk cache (see
Localize.Locale.Provider.Cache), it is returned.In
:devand:testenvironments, the locale is generated from the CLDR source data viaLocalize.Data.Locale.generate_and_transform/1.Otherwise, the locale is downloaded via
Localize.Locale.Provider.download_locale/1, written to the cache, decoded, and returned.
Arguments
localeis a locale identifier atom or aLocalize.LanguageTag.t/0.
Returns
{:ok, locale_data}wherelocale_datais a map of the locale's CLDR data.{:error, exception}if the locale data cannot be obtained.
Returns whether locale data has been loaded into :persistent_term.
Arguments
localeis a locale identifier atom or aLocalize.LanguageTag.t/0.
Returns
trueif the locale data is stored in:persistent_term.falseotherwise.
Stores locale data in :persistent_term.
Arguments
locale_idis a locale identifier atom.locale_datais a map of locale data to store.
Returns
:okon success.{:error, reason}on failure.