Crowdin Upload Action #61
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Crowdin Upload Action | |
on: | |
workflow_dispatch: | |
inputs: | |
upload_translations: | |
description: "Upload translations to Crowdin" | |
type: boolean | |
default: false | |
auto_approve_imported: | |
description: "Auto approve imported translations" | |
type: boolean | |
default: false | |
jobs: | |
synchronize-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 | |
{ | |
source: packages/webapp/public/locales/en/*.json, | |
translation: packages/webapp/public/locales/%two_letters_code%/%original_file_name%, | |
}, | |
# Frontend compiled translations | |
{ | |
source: packages/webapp/src/locales/en/*.json, | |
translation: packages/webapp/src/locales/%two_letters_code%/%original_file_name%, | |
}, | |
# Consent Forms | |
{ | |
source: packages/webapp/src/containers/Consent/locales/en/*.md, | |
translation: packages/webapp/src/containers/Consent/locales/%two_letters_code%/%original_file_name%, | |
}, | |
# Shared translations | |
{ | |
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) | |
{ | |
source: packages/api/src/jobs/locales/en/*.json, | |
translation: packages/api/src/jobs/locales/%two_letters_code%/%original_file_name%, | |
}, | |
# 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: Crowdin sync | |
uses: crowdin/github-action@v2 | |
with: | |
upload_sources: true | |
upload_translations: ${{ github.event.inputs.upload_translations || false }} | |
upload_sources_args: --preserve-hierarchy | |
upload_translations_args: --preserve-hierarchy | |
download_translations: false | |
auto_approve_imported: ${{ github.event.inputs.auto_approve_imported || false }} | |
import_eq_suggestions: true | |
crowdin_branch_name: ${{ env.BRANCH_NAME }} | |
source: ${{ matrix.locales.source }} # Sources pattern | |
translation: ${{ matrix.locales.translation }} # Translations pattern | |
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 }} |