View Source Cldr.Locale.Loader (Cldr v2.37.5)
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.
Summary
Functions
Read the locale json, decode it and make any necessary transformations.
Returns a list of all locales that are configured and available in the CLDR repository.
Returns a list of all locales that have RBNF data and that are configured and available in the CLDR repository.
Functions
@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.
@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]
@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.