From 1d739ed15aec86f68b38c8a8127d9e5011ee0fcc Mon Sep 17 00:00:00 2001 From: Ruggero Corsaletti Date: Mon, 21 Oct 2024 12:20:20 +0200 Subject: [PATCH] AAE-24008 Crowdin sync implementation (#10309) * AAE-24008 Crowdin implementation * removed new line from pull-from-crowdin.yml Co-authored-by: Anahide Tchertchian <608958+atchertchian@users.noreply.github.com> --------- Co-authored-by: Anahide Tchertchian <608958+atchertchian@users.noreply.github.com> --- .eslintrc.js | 7 +++++++ .github/workflows/pull-from-crowdin.yml | 23 +++++++++++++++++++++++ .github/workflows/release.yml | 21 +++++++++++++++++++++ crowdin.yml | 13 +++++++++++++ 4 files changed, 64 insertions(+) create mode 100644 .github/workflows/pull-from-crowdin.yml create mode 100644 crowdin.yml diff --git a/.eslintrc.js b/.eslintrc.js index 12a9ddc8a3..4add908591 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -198,6 +198,13 @@ module.exports = { files: ['*.ts'], extends: ['plugin:@angular-eslint/template/process-inline-templates'], excludedFiles: ['*.spec.ts'] + }, + { + files: ['*.json'], + parser: 'jsonc-eslint-parser', + rules: { + 'comma-dangle': ['error', 'never'] + } } ], diff --git a/.github/workflows/pull-from-crowdin.yml b/.github/workflows/pull-from-crowdin.yml new file mode 100644 index 0000000000..5ee2a3676a --- /dev/null +++ b/.github/workflows/pull-from-crowdin.yml @@ -0,0 +1,23 @@ +name: Pull Translations from Crowdin +on: + schedule: + - cron: "0 0 * * *" + workflow_dispatch: +jobs: + pull-from-crowdin: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1 + - name: Pull translations from Crowdin + uses: crowdin/github-action@6ed209d411599a981ccb978df3be9dc9b8a81699 # v2.1.1 + with: + upload_sources: false + download_translations: true + create_pull_request: true + localization_branch_name: automated-translations-update + pull_request_title: "GH auto: Automated Update of Translations from Crowdin" + pull_request_base_branch_name: develop + env: + GITHUB_TOKEN: ${{ secrets.BOT_GITHUB_TOKEN }} + CROWDIN_TOKEN: ${{ secrets.CROWDIN_TRANSLATIONS_TOKEN }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index ff16fe78e5..b89b75b59b 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -185,6 +185,27 @@ jobs: uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1 - uses: ./.github/actions/npm-check-bundle + push-translation-keys-to-crowdin: + name: Push translations keys to Crowdin + if: ${{ github.ref == 'refs/heads/develop' }} + runs-on: ubuntu-latest + needs: [ initialization, build ] + permissions: + contents: read + packages: read + actions: read + steps: + - name: Checkout + uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1 + + - name: Push Source Files to Crowdin + uses: crowdin/github-action@6ed209d411599a981ccb978df3be9dc9b8a81699 # v2.1.1 + with: + upload_sources: true + upload_sources_args: --delete-obsolete + env: + CROWDIN_TOKEN: ${{ secrets.CROWDIN_TRANSLATIONS_TOKEN }} + finalize: if: always() runs-on: ubuntu-latest diff --git a/crowdin.yml b/crowdin.yml new file mode 100644 index 0000000000..957385d117 --- /dev/null +++ b/crowdin.yml @@ -0,0 +1,13 @@ +"project_id": "11" +"api_token_env": "CROWDIN_TOKEN" +"base_path": "." +"base_url": "https://hyland.api.crowdin.com" +"preserve_hierarchy": true +"files": [ + { + "source": "/**/**/i18n/en.json", + "translation": "/%original_path%/%two_letters_code%.%file_extension%", + "export_only_approved": "true", + "update_option": "update_as_unapproved" + } +]