From b426b908a1da673252b7ff22c9acdfa07beff44f Mon Sep 17 00:00:00 2001 From: Pete Bell <104009652+pjbRPF@users.noreply.github.com> Date: Wed, 9 Jul 2025 15:33:08 +0100 Subject: [PATCH 1/2] Delete .DS_Store --- .DS_Store | Bin 6148 -> 0 bytes 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 .DS_Store diff --git a/.DS_Store b/.DS_Store deleted file mode 100644 index 572960e360df010e91ee23b266cbdcf0db1143d5..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 6148 zcmeHKO>Yx15FMwX-K9e008%eVmbgYGG<=H7vPpz0L6N!z4uC?IjmnDcy2=MRM3MFk zKZYy6guerCY!{_8y;Vq5^Q7?`+cUQO*0R?`q~d9Im#9HR0gSm8qF4d$XFG$MZ&?Q` zJH|fkQcSPt04(?)6yR@nojUZA_VCq~zuz7`qis5(Y_~8U)54^PL39Ha_;_{78?Bd^~BjeyZA9{mS}Aun}wq?~_kvmP`hd={O#Y-g520m?Ay# z2kGm4IO{iVbWAxJHJ=M(w{$FBEFGAavG9-_{%SLr!+ ze202aF+sUPH+2hf%esY7y9YJ9^x~Who^3e;Re>lV3Wx$1qJTf;g3SvVO$HGKM1jks z0G|&U#vFOB9NVJu9!s&p(NrqdiBSE63;oluHG>ROO!-%B7=S`?$z+<=CZ@ z@{bSYXIB1&qU`J#U)yj}kz*-E0a4(z0&A|?;QPOK{`>!QlGH>2QQ%T3pz7VE8)HfS zZauR&zH2q?1B}6OmE%7taO_o#SiXw4U>0cC?0_TBm1DF3@*`knkU|vrrwaTA)Dw8R From 6cdc518f1c7054253cd74036fbbf43ea1131fb23 Mon Sep 17 00:00:00 2001 From: sashamishcheriakova <135987917+sashamishcheriakova@users.noreply.github.com> Date: Fri, 31 Oct 2025 13:42:21 +0000 Subject: [PATCH 2/2] Add workflow folder --- .github/workflows/create-crowdin-project.yml | 20 +++++++ .github/workflows/download-translations.yml | 38 +++++++++++++ .github/workflows/hide-strings.yml | 36 ++++++++++++ .github/workflows/nttt-processing.yml | 58 ++++++++++++++++++++ .github/workflows/upload-sources.yml | 26 +++++++++ 5 files changed, 178 insertions(+) create mode 100644 .github/workflows/create-crowdin-project.yml create mode 100644 .github/workflows/download-translations.yml create mode 100644 .github/workflows/hide-strings.yml create mode 100644 .github/workflows/nttt-processing.yml create mode 100644 .github/workflows/upload-sources.yml diff --git a/.github/workflows/create-crowdin-project.yml b/.github/workflows/create-crowdin-project.yml new file mode 100644 index 0000000..d881f83 --- /dev/null +++ b/.github/workflows/create-crowdin-project.yml @@ -0,0 +1,20 @@ +name: Create Crowdin project + +on: + workflow_dispatch: + +jobs: + crowdin-create: + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Create crowdin project + uses: crowdin/github-action@v2 + with: + command: "project add" + command_args: "RPF-Project-${{ github.event.repository.name }} -l fr -l nl -l de -l hi -l it -l ja -l pt-BR -l es-419 -l uk" + env: + CROWDIN_API_TOKEN: ${{ secrets.CROWDIN_API_TOKEN }} + CROWDIN_PROJECT_ID: ${{ secrets.CROWDIN_PROJECT_ID }} diff --git a/.github/workflows/download-translations.yml b/.github/workflows/download-translations.yml new file mode 100644 index 0000000..9f19973 --- /dev/null +++ b/.github/workflows/download-translations.yml @@ -0,0 +1,38 @@ +name: Crowdin Download Action + +on: + schedule: + # Run every day at 1 AM UTC + - cron: "0 1 * * *" + workflow_dispatch: # Manual triggering + +concurrency: + group: crowdin-download + cancel-in-progress: true + +permissions: write-all + +jobs: + crowdin: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + ref: master + + - 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: "master" + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + CROWDIN_PROJECT_ID: ${{ secrets.CROWDIN_PROJECT_ID }} + CROWDIN_API_TOKEN: ${{ secrets.CROWDIN_API_TOKEN }} diff --git a/.github/workflows/hide-strings.yml b/.github/workflows/hide-strings.yml new file mode 100644 index 0000000..93a8a1d --- /dev/null +++ b/.github/workflows/hide-strings.yml @@ -0,0 +1,36 @@ +name: Crowdin Hide Strings + +on: + workflow_run: + workflows: ["Crowdin Upload Action"] + types: + - completed + +jobs: + crowdin-upload: + if: ${{ github.event.workflow_run.conclusion == 'success' }} + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Install Crowdin CLI + run: | + curl -L https://github.com/crowdin/crowdin-cli/releases/latest/download/crowdin-cli.zip -o crowdin-cli.zip + unzip crowdin-cli.zip -d crowdin-cli + mkdir -p ~/bin + mv crowdin-cli/*/crowdin ~/bin/crowdin + cp crowdin-cli/*/crowdin-cli.jar ~/bin/crowdin-cli.jar + chmod +x ~/bin/crowdin + echo "PATH=$HOME/bin:$PATH" >> $GITHUB_ENV + + - name: Hide matching strings + run: | + crowdin --version + crowdin string list --verbose | grep -E -- '--- /no-print ---|--- no-print|--- print-only|hero_image images/' | awk '{print $1}' | sed 's/^#//' | grep '^[0-9]\+$' + while read -r id; do + crowdin string edit "$id" --hidden + done + env: + CROWDIN_PROJECT_ID: ${{ secrets.CROWDIN_PROJECT_ID }} + CROWDIN_API_TOKEN: ${{ secrets.CROWDIN_API_TOKEN }} diff --git a/.github/workflows/nttt-processing.yml b/.github/workflows/nttt-processing.yml new file mode 100644 index 0000000..ba35944 --- /dev/null +++ b/.github/workflows/nttt-processing.yml @@ -0,0 +1,58 @@ +name: NTTT processing + +on: + # currently allowing manual trigger only + workflow_dispatch: + inputs: + branch: + description: 'Branch to process translations on' + required: false + default: 'l10n_crowdin_translations' + type: string + +permissions: write-all + +jobs: + nttt-processing: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + ref: ${{ inputs.branch || 'l10n_crowdin_translations'}} + + - name: Set up Python 3.11 + uses: actions/setup-python@v4 + with: + python-version: '3.11.0' + + - name: Install NTTT from GitHub repository + run: | + python -m pip install --upgrade pip + pip install git+https://github.com/raspberrypilearning/nttt.git + + - name: Run NTTT on all language directories except 'en' + run: | + for lang_dir in */; do + if [[ -d "$lang_dir" && "$lang_dir" != "en/" ]]; then + lang_code=$(basename "$lang_dir") + echo "Processing language: $lang_code" + cd "$lang_dir" + printf "y\n" | nttt -Y YES || true + cd .. + fi + done + + - name: Add changes to branch + run: | + git config --local user.email "action@github.com" + git config --local user.name "GitHub Action - NTTT Processing" + git add . + if git diff --staged --quiet; then + echo "No changes after NTTT processing" + else + git commit -m "Apply NTTT processing to translations" + git push origin HEAD:${{ inputs.branch || 'l10n_crowdin_translations'}} + fi + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/.github/workflows/upload-sources.yml b/.github/workflows/upload-sources.yml new file mode 100644 index 0000000..f91f55b --- /dev/null +++ b/.github/workflows/upload-sources.yml @@ -0,0 +1,26 @@ +name: Crowdin Upload Action + +on: + pull_request: + types: [closed] + branches: + - master + paths: ["en/**/*.*"] + +jobs: + crowdin-upload: + if: github.event.pull_request.merged == true + 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: false + download_translations: false + env: + CROWDIN_PROJECT_ID: ${{ secrets.CROWDIN_PROJECT_ID }} + CROWDIN_API_TOKEN: ${{ secrets.CROWDIN_API_TOKEN }}