GettextTranslator.Util.Extractor (gettext_translator v0.7.0)

Copy Markdown View Source

Handles extraction and merging of gettext translations.

In development (Mix available), runs mix gettext.extract --merge --no-fuzzy. In production (no Mix), falls back to merging .pot files into .po files using Expo.

Summary

Functions

Extracts and merges gettext translations.

Functions

extract_and_merge(gettext_path)

@spec extract_and_merge(String.t()) :: {:ok, String.t()} | {:error, any()}

Extracts and merges gettext translations.

Uses mix gettext.extract --merge in dev, or merges .pot files directly in prod.

Parameters

  • gettext_path - The path to the gettext directory

Returns

  • {:ok, message} on success
  • {:error, reason} on failure

Examples

iex> Extractor.extract_and_merge("/path/to/priv/gettext")
{:ok, "Extraction complete: ..."}