Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file removed .DS_Store
Binary file not shown.
20 changes: 20 additions & 0 deletions .github/workflows/create-crowdin-project.yml
Original file line number Diff line number Diff line change
@@ -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 }}
38 changes: 38 additions & 0 deletions .github/workflows/download-translations.yml
Original file line number Diff line number Diff line change
@@ -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 }}
36 changes: 36 additions & 0 deletions .github/workflows/hide-strings.yml
Original file line number Diff line number Diff line change
@@ -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 }}
58 changes: 58 additions & 0 deletions .github/workflows/nttt-processing.yml
Original file line number Diff line number Diff line change
@@ -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 }}
26 changes: 26 additions & 0 deletions .github/workflows/upload-sources.yml
Original file line number Diff line number Diff line change
@@ -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 }}