Skip to content

Crowdin Download Action #31

Crowdin Download Action

Crowdin Download Action #31

name: Crowdin Download Action
on:
workflow_dispatch:
jobs:
download-translations:
runs-on: ubuntu-latest
strategy:
fail-fast: false
max-parallel: 1 # Should be 1 to avoid parallel builds
matrix:
locales: [
# Frontend core i18n public translations
{
name: webapp_locales,
source: packages/webapp/public/locales/en/*.json,
translation: packages/webapp/public/locales/%two_letters_code%/%original_file_name%,
},
# Frontend compiled translations
{
name: webapp_compiled_locales,
source: packages/webapp/src/locales/en/*.json,
translation: packages/webapp/src/locales/%two_letters_code%/%original_file_name%,
},
# Consent Forms
{
name: webapp_consent,
source: packages/webapp/src/containers/Consent/locales/en/*.md,
translation: packages/webapp/src/containers/Consent/locales/%two_letters_code%/%original_file_name%,
},
# Shared translations
{
name: shared_locales,
source: packages/shared/locales/en/*.json,
translation: packages/shared/locales/%two_letters_code%/%original_file_name%,
},
# Backend tranlsations - skipping pdf (crop.json is copied jobs scheduler init during build)
{
name: api_job_locales,
source: packages/api/src/jobs/locales/en/*.json,
translation: packages/api/src/jobs/locales/%two_letters_code%/%original_file_name%,
},
# email templates
{
name: api_email_templates,
source: packages/api/src/templates/locales/en.json,
translation: packages/api/src/templates/locales/%two_letters_code%.%file_extension%,
},
]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Synchronize with Crowdin
uses: crowdin/github-action@v2
with:
upload_sources: false
upload_translations: false
download_translations: true
skip_untranslated_strings: true
export_only_approved: true
source: ${{ matrix.locales.source }} # Sources pattern
translation: ${{ matrix.locales.translation }} # Translations pattern
localization_branch_name: l10n_crowdin_translations_${{ env.BRANCH_NAME }}_${{ matrix.locales.name }}
create_pull_request: true
pull_request_title: "New Crowdin translations ${{ matrix.locales.name }}"
pull_request_body: "New Crowdin pull request with translations of ${{ matrix.locales.name }}"
pull_request_base_branch_name: ${{ env.BRANCH_NAME }}
crowdin_branch_name: ${{ env.BRANCH_NAME }}
env:
GITHUB_TOKEN: ${{ secrets.CROWDIN_TEMP_PERSONAL_TOKEN }}
CROWDIN_PROJECT_ID: ${{ secrets.CROWDIN_PROJECT_ID }}
CROWDIN_PERSONAL_TOKEN: ${{ secrets.CROWDIN_PERSONAL_TOKEN }}
BRANCH_NAME: ${{ github.head_ref || github.ref_name }}