diff --git a/.github/workflows/crowdin-to-github.yml b/.github/workflows/crowdin-to-github.yml new file mode 100644 index 000000000..8f9738343 --- /dev/null +++ b/.github/workflows/crowdin-to-github.yml @@ -0,0 +1,31 @@ +name: Crowdin To GitHub + +on: + workflow_dispatch: + schedule: + - cron: '15 * * * *' # sync every hour + +jobs: + synchronize-with-crowdin: + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Sync Crowdin to Github + uses: crowdin/github-action@v1.19.0 + with: + upload_sources: false + upload_translations: false + download_translations: true + localization_branch_name: i18n_crowdin + create_pull_request: true + push_sources: false + 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' + env: + CROWDIN_PROJECT_ID: ${{ secrets.CROWDIN_PROJECT_ID }} + CROWDIN_PERSONAL_TOKEN: ${{ secrets.CROWDIN_PERSONAL_TOKEN }} + GITHUB_TOKEN: ${{ github.token }} diff --git a/.github/workflows/github-to-crowdin.yml b/.github/workflows/github-to-crowdin.yml new file mode 100644 index 000000000..93f945540 --- /dev/null +++ b/.github/workflows/github-to-crowdin.yml @@ -0,0 +1,26 @@ +name: GitHub To Crowdin + +on: + push: + branches: [ main ] + +jobs: + synchronize-with-crowdin: + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Sync GH and Crowdin + uses: crowdin/github-action@v1.19.0 + with: + upload_sources: true + upload_translations: false + download_translations: false + create_pull_request: false + localization_branch_name: i18n_crowdin + env: + CROWDIN_PROJECT_ID: ${{ secrets.CROWDIN_PROJECT_ID }} + CROWDIN_PERSONAL_TOKEN: ${{ secrets.CROWDIN_PERSONAL_TOKEN }} + GITHUB_TOKEN: ${{ github.token }} diff --git a/crowdin.yml b/crowdin.yml new file mode 100644 index 000000000..f01898512 --- /dev/null +++ b/crowdin.yml @@ -0,0 +1,59 @@ +# +# Your Crowdin credentials +# +"project_id_env": "CROWDIN_PROJECT_ID" +"api_token_env": "CROWDIN_PERSONAL_TOKEN" +"base_path": "." +"base_url": "https://api.crowdin.com" + +# +# Choose file structure in Crowdin +# e.g. true or false +# +"preserve_hierarchy": true + +# +# Files configuration +# +files: [ + { + "source": "**/*.i18n.en-us.js", + "translation": "%original_path%/%file_name%.i18n.%locale%.js", + "languages_mapping": { + "locale": + { + "cs": "cs-cz", + "de": "de-de", + "fr": "fr-fr", + "hu": "hu-hu", + "it": "it-it", + "pt-BR": "pt-br", + "ro": "ro-ro", + "es-ES": "es-es", + "th": "th-th" + }, + }, + "translation_replace": { + ".i18n.en-us": "" + } + }, + { + "source": "/src/i18n/translations/en-us/global.js", + "translation": "/src/i18n/translations/%locale%/global.js", + "languages_mapping": { + "locale": + { + "cs": "cs-cz", + "de": "de-de", + "fr": "fr-fr", + "hu": "hu-hu", + "it": "it-it", + "pt-BR": "pt-br", + "ro": "ro-ro", + "es-ES": "es-es", + "th": "th-th" + }, + } + } + +]