From 8d21844f2fa80852150e230cab238bf2c6f66dec Mon Sep 17 00:00:00 2001 From: Andrii Bodnar Date: Tue, 14 May 2024 15:31:40 +0300 Subject: [PATCH] feat: setup Crowdin --- .github/workflows/localization.yml | 40 ++++++++++++++++++++++++++++++ crowdin.yml | 12 +++++++++ 2 files changed, 52 insertions(+) create mode 100644 .github/workflows/localization.yml create mode 100644 crowdin.yml diff --git a/.github/workflows/localization.yml b/.github/workflows/localization.yml new file mode 100644 index 00000000..3ec7ee59 --- /dev/null +++ b/.github/workflows/localization.yml @@ -0,0 +1,40 @@ +# This workflow will run Crowdin Action that will upload new texts to Crowdin, download the newest translations and create a PR +# For more information see: https://github.com/crowdin/github-action + +name: Crowdin Sync + +on: + push: + branches: [ main ] + paths: + - 'locales/en.yml' + +jobs: + synchronize-with-crowdin: + runs-on: ubuntu-latest + permissions: + contents: write + pull-requests: write + + steps: + - uses: actions/checkout@v4 + + - name: Crowdin + uses: crowdin/github-action@v1 + with: + # Upload sources to Crowdin + upload_sources: true + # Upload translations to Crowdin, only use true at initial run + upload_translations: true + # Download translations from Crowdin + download_translations: true + # Create a pull request with new translations + create_pull_request: true + pull_request_title: 'New Crowdin Translations' + pull_request_body: 'New Crowdin translations by [Crowdin GH Action](https://github.com/crowdin/github-action)' + pull_request_base_branch_name: main + localization_branch_name: l10n_crowdin_translations + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + CROWDIN_PROJECT_ID: ${{ secrets.CROWDIN_PROJECT_ID }} + CROWDIN_PERSONAL_TOKEN: ${{ secrets.CROWDIN_PERSONAL_TOKEN }} diff --git a/crowdin.yml b/crowdin.yml new file mode 100644 index 00000000..91b53e3d --- /dev/null +++ b/crowdin.yml @@ -0,0 +1,12 @@ +"project_id_env": "CROWDIN_PROJECT_ID" +"api_token_env": "CROWDIN_PERSONAL_TOKEN" +"base_path": "." + +"preserve_hierarchy": true + +"files": [ + { + "source": "locales/en.yml", + "translation": "locales/%two_letters_code%.yml" + } +]