Skip to content

Commit 90a016c

Browse files
committed
Add GitHub Actions workflow to sync translations with Transifex
1 parent 8f8b5fc commit 90a016c

1 file changed

Lines changed: 56 additions & 0 deletions

File tree

.github/workflows/sync.yml

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
name: "Sync Translations"
2+
3+
on:
4+
schedule:
5+
- cron: '0 0 * * *' # Run daily at midnight
6+
workflow_dispatch: # Allow manual triggers
7+
pull_request:
8+
types: [labeled] # Trigger on PR label
9+
10+
jobs:
11+
sync-translations:
12+
if: github.event_name == 'workflow_dispatch' || github.event_name == 'schedule' || github.event.label.name == 'sync-translations'
13+
runs-on: ubuntu-latest
14+
15+
steps:
16+
- name: Checkout repository
17+
uses: actions/checkout@v4
18+
19+
- name: Install Transifex CLI
20+
run: |
21+
cd /usr/local/bin
22+
sudo curl -o- https://raw.githubusercontent.com/transifex/cli/master/install.sh | bash
23+
24+
- name: Setup Python
25+
uses: actions/setup-python@v5
26+
with:
27+
python-version: '3.x'
28+
cache: 'pip'
29+
30+
- name: Install dependencies
31+
run: |
32+
sudo apt-get update
33+
sudo apt-get install -y gettext
34+
pip install transifex-python sphinx-intl
35+
36+
- name: Sync with Transifex
37+
env:
38+
TX_TOKEN: ${{ secrets.TX_TOKEN }}
39+
run: |
40+
# Pull reviewed translations from Transifex
41+
tx pull -f -l fa --mode=reviewed
42+
43+
# Format .po files
44+
find . -name "*.po" -exec msgcat --no-wrap {} -o {} \;
45+
46+
- name: Create Pull Request
47+
uses: peter-evans/create-pull-request@v5
48+
with:
49+
commit-message: "Update fa translations from Transifex"
50+
title: "Sync translations from Transifex"
51+
body: |
52+
This PR updates Persian (fa) translations from Transifex.
53+
- Pulls reviewed translations only
54+
- Auto-generated by GitHub Actions
55+
branch: update-translations
56+
delete-branch: true

0 commit comments

Comments
 (0)