Skip to content
Docs

Pull translations in CI

Create an API key and download translations from a build or script.

Everyone2 min read

Your app's build can download the latest translations itself, so nobody has to export files by hand. It needs a project API key.

1. Create an API key

  1. Open the project's settings

    In the project, select Settings and find API keys.

  2. Create the key

    Select Create API key, give it a name that says where it's used, such as "CI pipeline", and select Create. The name shows in Activity when the key pushes changes.

  3. Copy it

    Copy the token from the dialog, then select Done. You can copy it again later from the list with Copy token.

The list shows when each key was created and last used. A key works for this project only.

2. Give your build the key

Under Environment variables in the same settings page, Localizator shows the three values a download script needs, ready to paste into a .env file or your CI's secrets. Copy copies all three with the token of the newest API key; Reveal token shows it first:

LOCALIZATOR_API_URL=https://localizator.carcutter.io
LOCALIZATOR_PROJECT_ID=…
LOCALIZATOR_API_TOKEN=lt_…

The token used to be called LOCALIZATOR_TOKEN. Scripts built on Localizator's pull script still accept the old name, but it's deprecated: rename it to LOCALIZATOR_API_TOKEN.

Store the token as a secret in your CI, never in the repository.

3. Download the files

Call the API once per language:

curl -H "X-Api-Token: $LOCALIZATOR_API_TOKEN" \
  "$LOCALIZATOR_API_URL/api/v1/projects/$LOCALIZATOR_PROJECT_ID/files/download?lang_codes=de" \
  -o assets/i18n/de.json

For Flutter, add &type=arb (see Flutter & CI setup). To fill empty values from the source language, add &export_empty_as=main. To list the project's languages first, call /status. Everything is in the API reference.

The same key can also push translations into Localizator, for example strings added in code. See Load (upload) a locale.

Revoke a key

If a key leaks, or isn't used any more, select the bin icon next to it and confirm with Revoke key. Anything using it loses access at once. Create a new one for the build.

Related