Downloads locale ETF files from the Localize CDN and stores them in the configured locale cache directory.
This task is intended to be run at build time (e.g. in a Dockerfile or CI pipeline) so that all required locales are available in the cache before the application starts. This avoids the need for runtime downloads in production.
Usage
mix localize.download_localesDownloads the configured :supported_locales. When
:supported_locales is not configured (meaning all CLDR
locales are supported), prompts for confirmation before
downloading.
mix localize.download_locales en fr de jaDownloads the specified locales.
mix localize.download_locales --allDownloads all CLDR locales without prompting.
mix localize.download_locales --forceWhen :supported_locales is not configured, downloads all
locales without prompting. Useful in CI/Docker where there
is no interactive terminal.
Output directory
Files are written to the directory returned by
Localize.Locale.Provider.locale_cache_dir/0, which defaults
to Application.app_dir(:localize, "priv/localize/locales").
Override with:
config :localize, locale_cache_dir: "/path/to/cache"Examples
Pre-populate the cache for a Docker build:
# Dockerfile
RUN mix localize.download_localesDownload specific locales for testing:
mix localize.download_locales en de ja zhDownload everything in a non-interactive environment:
mix localize.download_locales --force