View Source Cldr.Install (Cldr v2.40.1)

Provides functions for installing locales.

When installed as a package on from hex, Cldr has only the default locales ["en", "und"] installed and configured.

When other locales are added to the configuration Cldr will attempt to download the locale from github during compilation.

If Cldr is installed from github directly then all locales are already installed.

Summary

Functions

Returns the full pathname of the locale's json file.

Install all available locales.

Install all the configured locales.

Download the requested locale from github into the client application's cldr data directory.

Returns a boolean indicating if the requested locale is installed.

Returns a boolean indicating if the requested locale has available data but the data is stale (is a older version not supported by this version of ex_cldr.)

Functions

See Cldr.Config.client_data_dir/1.

Link to this function

client_locale_file(locale, config)

View Source

Returns the full pathname of the locale's json file.

No checking of locale validity is performed.

Link to this function

client_locales_dir(config)

View Source

See Cldr.Config.client_locales_dir/1.

Link to this function

install_all_locale_names(config)

View Source

Install all available locales.

Link to this function

install_known_locale_names(config)

View Source

Install all the configured locales.

Link to this function

install_locale_name(locale_name, config, options \\ [])

View Source

Download the requested locale from github into the client application's cldr data directory.

  • locale is any locale returned by Cldr.known_locale_names/1

  • options is a keyword list. Currently the only supported option is :force which defaults to false. If truthy the locale will be installed or re-installed.

The data directory is typically priv/cldr/locales.

This function is intended to be invoked during application compilation when a valid locale is configured but is not yet installed in the application.

An https request to the master github repository for Cldr is made to download the correct version of the locale file which is then written to the configured data directory.

See Cldr.Config.locale_filename/1.

Link to this function

locale_installed?(locale, config)

View Source

Returns a boolean indicating if the requested locale is installed.

No checking of the validity of the locale itself is performed. The check is based upon whether there is a locale file installed in the client application or in Cldr itself.

Link to this function

locale_stale?(locale_name, config)

View Source

Returns a boolean indicating if the requested locale has available data but the data is stale (is a older version not supported by this version of ex_cldr.)