Automatic Gettext locale translator for Elixir/Phoenix projects.

elixir, gettext, locale, phoenix-framework, translation


Getatrex circleci

Gettext Automatic Translator Written in Elixir

Translates .PO files generated by gettext in your Elixir/Phoenix project

Demo how it works



Install package

The package can be installed by adding getatrex to your list of dependencies in mix.exs:

def deps do
  [{:getatrex, "~> 0.1.0", only: :dev, runtime: false}]

This will install goth package as a dependency which you will need to set up in order to use for Google automatic translations.

Add Google Cloud Translation API Key for Goth package

If you don't have API key, you can get it in your Google Cloud Console

Download JSON file with credentials, put it somewhere (not recommending to put in under source control).

Open your config/config.exs file and add following:

# Google credentials
config :goth, json: "goth_credentials.json" |>!

where json is the path to you credentials file.

Getting started

  1. Follow instruction in the Workflow section of the gettext library

  2. Generate new locale, e.g. for Spanish this would be:

$ mix gettext.merge priv/gettext --locale es
  1. IMPORTANT! Do the git commit -a -m 'adding new spanish locale' to have previous version fixed in git with possibility to easily edit and revert.

  2. Translate new Spanish locale with getatrex:

$ mix getatrex es

Now you have new file created translated_default.po with translations, you can now open your IDE to fix silly translations and replace original default.po when you done.


  1. Write translations to original default.po to avoid this copy-paste step
  2. Implement plurals
  3. Translate errors.po