@@ -32,41 +32,22 @@ jobs:
3232 -name :Check out this repository
3333uses :actions/checkout@v5
3434
35- -name :Checkout CPython ${{ env.PYDOC_VERSION }}
36- uses :actions/checkout@v5
37- with :
38- repository :' python/cpython'
39- ref :${{ env.PYDOC_VERSION }}
40- path :cpython
41-
4235 -name :Set language dir variable
4336run :
44- echo "LANGUAGE_DIR=cpython/Doc/locales/ ${{ env.PYDOC_LANGUAGE }}/LC_MESSAGES " >> $GITHUB_ENV
37+ echo "PYDOC_LANG_DIR= ${{ env.PYDOC_VERSION }}" >> $GITHUB_ENV
4538
4639 -name :Checkout this repository ${{ env.PYDOC_VERSION }}
4740uses :actions/checkout@v5
4841with :
4942ref :${{ env.PYDOC_VERSION }}
50- path :${{ env.LANGUAGE_DIR }}
43+ path :${{ env.PYDOC_LANG_DIR }}
5144
5245 -uses :actions/setup-python@v6
5346with :
5447python-version :${{ inputs.version }}
5548allow-prereleases :true
5649cache :' pip'
57- cache-dependency-path :|
58- requirements.txt
59- cpython/Doc/requirements.txt
60-
61- -name :Check for Transifex API Token availability
62- id :secret-check
63- # perform secret check & put boolean result as an output
64- shell :bash
65- run :|
66- available=false
67- [[ "${{ secrets.TX_TOKEN }}" != '' ]] && available=true
68- echo "available=$available" >> $GITHUB_OUTPUT
69- echo "available=$available"
50+ cache-dependency-path :requirements.txt
7051
7152# 2- Install dependencies
7253
@@ -81,19 +62,19 @@ jobs:
8162 -name :Install Python dependencies
8263run :|
8364 pip install -r requirements.txt
84- make -C cpython/Doc venv
8565
8666# 3- Pull translations
8767
88- -name :Generate template files and Transifex config file
89- run :./scripts/generate_templates.sh
68+ -name :Generate updated .tx/config
69+ if :${{ contains(fromJSON('["schedule", "workflow_dispatch"]'), github.event_name) }}
70+ run :python scripts/generate_txconfig.py -p ./${{ env.PYDOC_LANG_DIR }} ${{ env.PYDOC_TX_PROJECT }}
9071
9172 -name :Pull translations from Transifex
9273id :pull
9374if :${{ contains(fromJSON('["schedule", "workflow_dispatch"]'), github.event_name) }}
9475run :|
9576 # Clean up obsolete files
96- find ./${{ env.LANGUAGE_DIR }} -name '*.po' -exec rm {} \;
77+ find ./${{ env.PYDOC_LANG_DIR }} -name '*.po' -exec rm {} \;
9778 ./scripts/pull_translations.sh
9879env :
9980TX_TOKEN :${{ secrets.TX_TOKEN }}
@@ -103,26 +84,26 @@ jobs:
10384run :|
10485 newer_branch=${PYDOC_VERSION%%.*}.$((${PYDOC_VERSION##*.}+1))
10586 git clone --depth 1 --single-branch --branch $newer_branch https://github.com/python/python-docs-pt-br ${newer_branch}-dir
106- pomerge --from ./${newer_branch}-dir/{**/,}*.po --to ./${{ env.LANGUAGE_DIR }}/{**/,}*.po
87+ pomerge --from ./${newer_branch}-dir/{**/,}*.po --to ./${{ env.PYDOC_LANG_DIR }}/{**/,}*.po
10788 rm -rf ./${newer_branch}-dir
10889
10990 -name :powrap
11091if :steps.pull.outcome == 'success'
11192run :|
112- cd ./${{ env.LANGUAGE_DIR }}
93+ cd ./${{ env.PYDOC_LANG_DIR }}
11394 powrap *.po **/*.po
11495
11596 -name :Update statistics
11697if :always()
11798run :|
11899 ./scripts/stats.py
119- git -C ./${{ env.LANGUAGE_DIR }} diff stats.json
100+ git -C ./${{ env.PYDOC_LANG_DIR }} diff stats.json
120101
121102 -name :Update potodo.md
122103if :always()
123104run :|
124105 ./scripts/potodo.sh
125- gitdiff ./${{ env.LANGUAGE_DIR }}/ potodo.md
106+ git-C ./${{ env.PYDOC_LANG_DIR }} diff potodo.md
126107
127108# 4- Commit and push translations
128109
@@ -132,7 +113,7 @@ jobs:
132113 -name :Push
133114if :${{ contains(fromJSON('["schedule", "workflow_dispatch"]'), github.event_name) }}
134115run :|
135- cd ./${{ env.LANGUAGE_DIR }}
116+ cd ./${{ env.PYDOC_LANG_DIR }}
136117 git push
137118
138119