# Getatrex 
Gettext Automatic Translator Written in Elixir
Translates *.POT* files generated by gettext in your Elixir/Phoenix project
## Installation
#### Install package
The package can be installed by adding `getatrex` to your list of dependencies in `mix.exs`:
```elixir
def deps do
[{:getatrex, "~> 0.1.0", only: :dev, runtime: false}]
end
```
This will install [`goth`](https://github.com/peburrows/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 https://console.cloud.google.com/apis/credentials
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" |> File.read!
```
where `json` is the path to you credentials file.
## Getting started
1. Follow instruction in the [Workflow section](https://github.com/elixir-lang/gettext#workflow) of the gettext library
2. Generate new locale, e.g. for Spanish this would be:
```
$ mix gettext.merge priv/gettext --locale es
```
3. **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.
4. 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.
## TODO
1. Write translations to original default.po to avoid this copy-paste step