Use CircleCI with Crowdin CLI to automate your frequent localization tasks such as uploading source files, downloading translations or anything else you can do with Crowdin CLI.
Push the crowdin.yml
configuration file to the repository.
Use Environment Variables for API Credentials:
"project_id_env": "CROWDIN_PROJECT_ID"
"api_token_env": "CROWDIN_PERSONAL_TOKEN"
See the Introduction to environment variables to learn more about defining variables in CircleCI.
version: 2
orbs:
node: circleci/node@5.2.1
workflows:
localization:
environment:
CROWDIN_PROJECT_ID: $CROWDIN_PROJECT_ID
CROWDIN_PERSONAL_TOKEN: $CROWDIN_PERSONAL_TOKEN
jobs:
- upload:
executor: node/default
steps:
- checkout
- run: npm install -g @crowdin/cli
- run: crowdin push
- download:
executor: node/default
steps:
- checkout
- run: npm install -g @crowdin/cli
- run: crowdin pull --no-progress --keep-archive
- store_artifacts:
path: CrowdinTranslations_*.zip
on:
push:
branches:
- main
The localization workflow above has two jobs: upload
and download
. The upload
job installs the @crowdin/cli
npm package and then runs the crowdin push
command to push the source files to Crowdin. The download job runs the crowdin pull
command to download translations from Crowdin. The download
job also stores the downloaded translations as the pipeline artifact.
For more information about Crowdin CLI commands visit the official Crowdin CLI website.
Notify your CircleCI when there are new translations and that the build is required. This guide describes setting up a Crowdin webhook to invoke the build.
CircleCI' documentation says we should send the following request to trigger the build.
curl --request POST \
--url https://circleci.com/api/v2/project/vcs-slug/org-name/repo-name/pipeline \
--header 'Circle-Token: ***********************************' \
--header 'content-type: application/json' \
--data '{"parameters":{"run_workflow_build":false, "run_workflow_deploy":false}}'
We will configure Crowdin to send this request without any middleware, just by setting up the webhook on a needed event (e.g. File is 100% translated).
Depending on a Crowdin Edition you use, please check the documentation how to create a webhook in crowdin.com and Crowdin Enterprise.
Below is an example of a fully configured Crowdin webhook.
Use the following template to create a webhook URL: https://circleci.com/api/v2/project/<your-vcs-like-github>/<organization-name>/<repo-slug>/pipeline
.
For more advanced setup please refer to the official documentation.
Crowdin is a platform that helps you manage and translate content into different languages. Integrate Crowdin with your repo, CMS, or other systems. Source content is always up to date for your translators, and translated content is returned automatically.
Learn MoreReleased on Aug 7, 2022
Updated on Jul 30, 2024
Published by Community
Identifier:circle-ci