Skip to content

Commit

Permalink
Merge pull request #3273 from LiteFarmOrg/add-crowdin-action-to-main
Browse files Browse the repository at this point in the history
LF-4276 - checkout new action files to main
  • Loading branch information
SayakaOno authored Jun 25, 2024
2 parents 1b709f3 + a31eb10 commit 883c5ef
Show file tree
Hide file tree
Showing 2 changed files with 95 additions and 0 deletions.
33 changes: 33 additions & 0 deletions .github/workflows/crowdin-download.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Crowdin Download Action

on:
workflow_dispatch:

jobs:
download-translations:
runs-on: ubuntu-latest
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: packages/webapp/public/locales/en/*.json # Sources pattern
translation: packages/webapp/public/locales/%two_letters_code%/%original_file_name% # Translations pattern
localization_branch_name: l10n_crowdin_translations_${{ env.BRANCH_NAME }}
create_pull_request: true
pull_request_title: "New Crowdin translations"
pull_request_body: "New Crowdin pull request with translations"
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 }}
62 changes: 62 additions & 0 deletions .github/workflows/crowdin-upload.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: Crowdin Upload Action

on:
workflow_dispatch:
push:
branches:
- integration
paths:
- "**/locales/**.md"
- "**/locales/**.json"

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 translations
{
source: packages/webapp/public/locales/en/*.json,
translation: packages/webapp/public/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%,
},
# 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: true
upload_sources_args: --preserve-hierarchy
upload_translations_args: --preserve-hierarchy
download_translations: false
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 }}

0 comments on commit 883c5ef

Please sign in to comment.