Create a project key
In Continuous Translations open Project settings → CI & CLI and create a project key. Store it as the secret
CT_API_KEY in your CI.Add a ct.yml
Put a ct.yml in the root of the repository. ct init writes one for you:
SH
ct init --project 12 --source locales/en.json --pattern "locales/{lang}.json"Push on every push
Run
ct push in your pipeline. ct snippet github and ct snippet gitlab print a ready-made job.ct.yml #
ct.yml
project: 12
format: json # see File formats
# sourceLanguage: en # language code of the source file (default en)
source: locales/en.json
translations: locales/{lang}.json # {lang} is replaced by the language code
defaultBranch: main # the Git branch that maps to CT's main branch
# prune: true # delete keys from CT when they leave the source file| Setting | Description |
|---|---|
project | The project to sync with |
format | The file format, see File formats |
sourceLanguage | Language code of the source file, en by default |
source | The file with your source strings |
translations | Where translations are written. {lang} is the language code |
defaultBranch | The Git branch that maps to the main branch in Continuous Translations |
prune | Delete keys from Continuous Translations when they leave the source file |
Environment #
| Variable | Purpose |
|---|---|
CT_API_KEY | The project key. Required |
CT_API_URL | The API to talk to. Defaults to https://api.continuous-translations.com |
CT_BRANCH | The branch to use, see Commands |