File tree Expand file tree Collapse file tree 6 files changed +196
-0
lines changed
Expand file tree Collapse file tree 6 files changed +196
-0
lines changed Original file line number Diff line number Diff line change 1+ name : Create Crowdin project
2+
3+ on :
4+ workflow_dispatch :
5+
6+ jobs :
7+ crowdin-create :
8+ runs-on : ubuntu-latest
9+ steps :
10+ - name : Checkout repository
11+ uses : actions/checkout@v4
12+
13+ - name : Create crowdin project
14+ uses : crowdin/github-action@v2
15+ with :
16+ command : " project add"
17+ 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"
18+ env :
19+ CROWDIN_API_TOKEN : ${{ secrets.CROWDIN_API_TOKEN }}
20+ CROWDIN_PROJECT_ID : ${{ secrets.CROWDIN_PROJECT_ID }}
Original file line number Diff line number Diff line change 1+ name : Crowdin Download Action
2+
3+ on :
4+ schedule :
5+ # Run every day at 1 AM UTC
6+ - cron : " 0 1 * * *"
7+ workflow_dispatch : # Manual triggering
8+
9+ concurrency :
10+ group : crowdin-download
11+ cancel-in-progress : true
12+
13+ permissions : write-all
14+
15+ jobs :
16+ crowdin :
17+ runs-on : ubuntu-latest
18+ steps :
19+ - name : Skip if Crowdin ID missing
20+ run : |
21+ if [ -z "${{ secrets.CROWDIN_PROJECT_ID }}" ]; then
22+ echo "Skipping Crowdin sync — no project ID set."
23+ exit 0
24+ fi
25+ - name : Checkout
26+ uses : actions/checkout@v4
27+ with :
28+ ref : master
29+
30+ - name : Synchronize with Crowdin
31+ uses : crowdin/github-action@v2
32+ with :
33+ upload_sources : false
34+ upload_translations : false
35+ download_translations : true
36+ localization_branch_name : l10n_crowdin_translations
37+ create_pull_request : true
38+ pull_request_title : " New Crowdin translations"
39+ pull_request_body : " New Crowdin pull request with translations"
40+ pull_request_base_branch_name : " master"
41+ env :
42+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
43+ CROWDIN_PROJECT_ID : ${{ secrets.CROWDIN_PROJECT_ID }}
44+ CROWDIN_API_TOKEN : ${{ secrets.CROWDIN_API_TOKEN }}
Original file line number Diff line number Diff line change 1+ name : Crowdin Hide Strings
2+
3+ on :
4+ workflow_run :
5+ workflows : ["Crowdin Upload Action"]
6+ types :
7+ - completed
8+
9+ jobs :
10+ crowdin-upload :
11+ if : ${{ github.event.workflow_run.conclusion == 'success' }}
12+ runs-on : ubuntu-latest
13+ steps :
14+ - name : Checkout
15+ uses : actions/checkout@v4
16+
17+ - name : Install Crowdin CLI
18+ run : |
19+ curl -L https://github.com/crowdin/crowdin-cli/releases/latest/download/crowdin-cli.zip -o crowdin-cli.zip
20+ unzip crowdin-cli.zip -d crowdin-cli
21+ mkdir -p ~/bin
22+ mv crowdin-cli/*/crowdin ~/bin/crowdin
23+ cp crowdin-cli/*/crowdin-cli.jar ~/bin/crowdin-cli.jar
24+ chmod +x ~/bin/crowdin
25+ echo "PATH=$HOME/bin:$PATH" >> $GITHUB_ENV
26+
27+ - name : Hide matching strings
28+ run : |
29+ crowdin --version
30+ crowdin string list --verbose | grep -E -- '--- /no-print ---|--- no-print|--- print-only|hero_image images/' | awk '{print $1}' | sed 's/^#//' | grep '^[0-9]\+$'
31+ while read -r id; do
32+ crowdin string edit "$id" --hidden
33+ done
34+ env :
35+ CROWDIN_PROJECT_ID : ${{ secrets.CROWDIN_PROJECT_ID }}
36+ CROWDIN_API_TOKEN : ${{ secrets.CROWDIN_API_TOKEN }}
Original file line number Diff line number Diff line change 1+ name : NTTT processing
2+
3+ on :
4+ # currently allowing manual trigger only
5+ workflow_dispatch :
6+ inputs :
7+ branch :
8+ description : ' Branch to process translations on'
9+ required : false
10+ default : ' l10n_crowdin_translations'
11+ type : string
12+
13+ permissions : write-all
14+
15+ jobs :
16+ nttt-processing :
17+ runs-on : ubuntu-latest
18+ steps :
19+ - name : Checkout
20+ uses : actions/checkout@v4
21+ with :
22+ ref : ${{ inputs.branch || 'l10n_crowdin_translations'}}
23+
24+ - name : Set up Python 3.11
25+ uses : actions/setup-python@v4
26+ with :
27+ python-version : ' 3.11.0'
28+
29+ - name : Install NTTT from GitHub repository
30+ run : |
31+ python -m pip install --upgrade pip
32+ pip install git+https://github.com/raspberrypilearning/nttt.git
33+
34+ - name : Run NTTT on all language directories except 'en'
35+ run : |
36+ for lang_dir in */; do
37+ if [[ -d "$lang_dir" && "$lang_dir" != "en/" ]]; then
38+ lang_code=$(basename "$lang_dir")
39+ echo "Processing language: $lang_code"
40+ cd "$lang_dir"
41+ printf "y\n" | nttt -Y YES || true
42+ cd ..
43+ fi
44+ done
45+
46+ - name : Add changes to branch
47+ run : |
48+ git config --local user.email "[email protected] " 49+ git config --local user.name "GitHub Action - NTTT Processing"
50+ git add .
51+ if git diff --staged --quiet; then
52+ echo "No changes after NTTT processing"
53+ else
54+ git commit -m "Apply NTTT processing to translations"
55+ git push origin HEAD:${{ inputs.branch || 'l10n_crowdin_translations'}}
56+ fi
57+ env :
58+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
Original file line number Diff line number Diff line change 1+ name : Crowdin Upload Action
2+
3+ on :
4+ pull_request :
5+ types : [closed]
6+ branches :
7+ - master
8+ paths : ["en/**/*.*"]
9+
10+ workflow_dispatch :
11+
12+ jobs :
13+ crowdin-upload :
14+ if : (github.event.pull_request.merged == true) || (github.event_name == 'workflow_dispatch')
15+ runs-on : ubuntu-latest
16+ steps :
17+ - name : Checkout
18+ uses : actions/checkout@v4
19+
20+ - name : Crowdin push
21+ uses : crowdin/github-action@v2
22+ with :
23+ upload_sources : true
24+ upload_translations : false
25+ download_translations : false
26+ env :
27+ CROWDIN_PROJECT_ID : ${{ secrets.CROWDIN_PROJECT_ID }}
28+ CROWDIN_API_TOKEN : ${{ secrets.CROWDIN_API_TOKEN }}
Original file line number Diff line number Diff line change 1+ " project_id_env " : " CROWDIN_PROJECT_ID"
2+ " api_token_env " : " CROWDIN_API_TOKEN"
3+ base_path : " ."
4+ base_url : " https://api.crowdin.com"
5+ preserve_hierarchy : true
6+
17files :
28 - source : /en/**/*.*
39 translation : /%locale%/**/%original_file_name%
10+ ignore :
11+ - /en/**/*.pdf
12+ - /en/**/*.mp3
13+ - /en/**/*.zip
You can’t perform that action at this time.
0 commit comments