ct.yml #
ct looks for ct.yml (or ct.yaml) in the current directory and then in its parent directories, so you can run it from a subfolder. Every path in the file is relative to the folder that holds it. ct init writes one.
project: 0197a3c2-5b1e-7c4a-9d2f-3e8b6a1f0c55
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 | Required | Description |
|---|---|---|
project | yes | The id (a UUID) of the project to sync with |
format | no | The file format, json by default. See File formats |
sourceLanguage | no | Language code of the source file, en by default |
source | yes | The file with your source strings |
translations | yes | Where translations are written. It must contain {lang}, which is replaced by the language code |
defaultBranch | no | The Git branch that maps to the main branch in Continuous Translations, main by default |
prune | no | true deletes keys from Continuous Translations when they leave the source file. ct push --prune does the same for one run |
Environment #
| Variable | Purpose |
|---|---|
CT_API_KEY | The project key. Required for every command except init and snippet |
CT_API_URL | The API to talk to. Defaults to https://api.continuous-translations.com |
CT_BRANCH | The Git branch to use, see Which branch |
Which branch #
The commands work on one branch. Its name comes from, in order:
--branch <name>CT_BRANCH- The CI variables of GitHub and GitLab, pull request (merge request) branches first
git, the branch that is checked out
If none of these gives a name, the command fails and asks for --branch.
The Git branch named by defaultBranch is the main branch in Continuous Translations. Any other Git branch becomes a branch of the same name, created from main on the first push. Characters outside letters, digits, ., _, / and - in the name are replaced by -. ct tag create and ct merge have their own rules, see their pages.
Exit codes #
A command exits with 0 when it succeeded and 1 when it failed, so a pipeline stops on a failure. ct pull --check and ct check also exit 1 when they find something that is behind, see ct pull and ct check.