diff --git a/.github/workflows/crowdin-download.yml b/.github/workflows/crowdin-download.yml new file mode 100644 index 0000000..32815c8 --- /dev/null +++ b/.github/workflows/crowdin-download.yml @@ -0,0 +1,33 @@ +name: Download Crowdin Translations + +on: + push: + branches: [main] + +permissions: + contents: write + pull-requests: write + +jobs: + crowdin: + 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 + localization_branch_name: l10n_crowdin_translations + + create_pull_request: true + pull_request_title: "New Crowdin translations" + pull_request_body: "New Crowdin pull request with translations" + pull_request_base_branch_name: "main" + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + CROWDIN_PROJECT_ID: ${{ secrets.CROWDIN_PROJECT_ID }} + CROWDIN_PERSONAL_TOKEN: ${{ secrets.CROWDIN_PERSONAL_TOKEN }} diff --git a/.github/workflows/crowdin-upload.yml b/.github/workflows/crowdin-upload.yml new file mode 100644 index 0000000..76d6d8a --- /dev/null +++ b/.github/workflows/crowdin-upload.yml @@ -0,0 +1,23 @@ +name: Upload Crowdin Sources + +on: + push: + paths: ["html/i18n/**"] + branches: [main] + +jobs: + crowdin-upload: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Crowdin push + uses: crowdin/github-action@v2 + with: + upload_sources: true + upload_translations: true + download_translations: false + env: + CROWDIN_PROJECT_ID: ${{ secrets.CROWDIN_PROJECT_ID }} + CROWDIN_PERSONAL_TOKEN: ${{ secrets.CROWDIN_PERSONAL_TOKEN }} diff --git a/crowdin.yml b/crowdin.yml index b8674be..9027d2b 100644 --- a/crowdin.yml +++ b/crowdin.yml @@ -1,3 +1,14 @@ +"project_id_env": "CROWDIN_PROJECT_ID" +"api_token_env": "CROWDIN_PERSONAL_TOKEN" +"base_path": "." +"base_url": "https://api.crowdin.com" + +"preserve_hierarchy": true + files: - - source: /html/i18n/en.json - translation: /%original_path%/%two_letters_code%.json + [ + { + "source": "/html/i18n/en.json", + "translation": "/html/i18n/%two_letters_code%.json", + }, + ]