From 17cd4cdc1983c99f9d99da9d7b17d04f4463117c Mon Sep 17 00:00:00 2001 From: James Rich <2199651+jamesarich@users.noreply.github.com> Date: Tue, 29 Apr 2025 12:35:02 -0500 Subject: [PATCH] chore(l10n): Add Crowdin localization workflow and configuration (#1798) --- .github/workflows/crowdin.yml | 37 +++++++++++++++++++++++++++++++++++ config/crowdin/crowdin.yml | 36 ++++++++++++++++++++++++++++++++++ 2 files changed, 73 insertions(+) create mode 100644 .github/workflows/crowdin.yml create mode 100644 config/crowdin/crowdin.yml diff --git a/.github/workflows/crowdin.yml b/.github/workflows/crowdin.yml new file mode 100644 index 000000000..58c406f5f --- /dev/null +++ b/.github/workflows/crowdin.yml @@ -0,0 +1,37 @@ +name: Crowdin Action + +on: + push: + branches: [ master ] + +jobs: + synchronize-with-crowdin: + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Synchronize with Crowdin + uses: crowdin/github-action@v2 + with: + base_url: 'https://meshtastic.crowdin.com/api/v2' + config: 'config/crowdin/crowdin.yml' + upload_sources: true + upload_translations: false + download_translations: true + localization_branch_name: l10n_crowdin_translations + create_pull_request: true + pull_request_title: 'chore(l10n): New Crowdin Translations' + pull_request_body: 'New Crowdin translations by [Crowdin GH Action](https://github.com/crowdin/github-action)' + pull_request_base_branch_name: 'master' + crowdin_branch_name: 'master' + env: + # A classic GitHub Personal Access Token with the 'repo' scope selected (the user should have write access to the repository). + GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} + + # A numeric ID, found at https://crowdin.com/project//tools/api + CROWDIN_PROJECT_ID: ${{ secrets.CROWDIN_PROJECT_ID }} + + # Visit https://crowdin.com/settings#api-key to create this token + CROWDIN_PERSONAL_TOKEN: ${{ secrets.CROWDIN_PERSONAL_TOKEN }} \ No newline at end of file diff --git a/config/crowdin/crowdin.yml b/config/crowdin/crowdin.yml new file mode 100644 index 000000000..778cd43b4 --- /dev/null +++ b/config/crowdin/crowdin.yml @@ -0,0 +1,36 @@ +# +# Basic Crowdin CLI configuration +# See https://crowdin.github.io/crowdin-cli/configuration for more information +# See https://support.crowdin.com/developer/configuration-file/ for all available options +# + +# +# Crowdin credentials +# +"project_id_env": "CROWDIN_PROJECT_ID" +"api_token_env": "CROWDIN_PERSONAL_TOKEN" +"base_path": "." +"base_url": "https://meshtastic.crowdin.com/api/v2" + +# +# Defines whether to preserve the original directory structure in the Crowdin project +# Recommended to set to true +# +"preserve_hierarchy": false + +# +# Files configuration. +# See https://support.crowdin.com/developer/configuration-file/ for all available options +# +"files": [ + { + "source": "/**/values/strings.xml", + "translation": "/**/values-%two_letters_code%/%original_file_name%", + "translation_replace": { + "sr-Latn": "b+sr+Latn", + }, + "update_strings": true, + "cleanup_mode": true, + "escape_special_characters": 1 + } +] \ No newline at end of file