Manual
CLI
API
Log in Get started free

Configuration

The ct.yml settings, the environment variables, and how the branch is chosen.

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.

ct.yml
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
SettingRequiredDescription
projectyesThe id (a UUID) of the project to sync with
formatnoThe file format, json by default. See File formats
sourceLanguagenoLanguage code of the source file, en by default
sourceyesThe file with your source strings
translationsyesWhere translations are written. It must contain {lang}, which is replaced by the language code
defaultBranchnoThe Git branch that maps to the main branch in Continuous Translations, main by default
prunenotrue deletes keys from Continuous Translations when they leave the source file. ct push --prune does the same for one run

Environment #

VariablePurpose
CT_API_KEYThe project key. Required for every command except init and snippet
CT_API_URLThe API to talk to. Defaults to https://api.continuous-translations.com
CT_BRANCHThe Git branch to use, see Which branch

Which branch #

The commands work on one branch. Its name comes from, in order:

  1. --branch <name>
  2. CT_BRANCH
  3. The CI variables of GitHub and GitLab, pull request (merge request) branches first
  4. 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.