mix localize.download_locales (Localize v0.5.0)

Copy Markdown View Source

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_locales

Downloads 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 ja

Downloads the specified locales.

mix localize.download_locales --all

Downloads all CLDR locales without prompting.

mix localize.download_locales --force

When :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_locales

Download specific locales for testing:

mix localize.download_locales en de ja zh

Download everything in a non-interactive environment:

mix localize.download_locales --force