forked from psychopy/psychopy
-
Notifications
You must be signed in to change notification settings - Fork 0
52 lines (44 loc) · 1.57 KB
/
translation.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
name: Generate Psychopy translations
on:
workflow_dispatch:
push:
branches:
- testTranslationWorkflow
#paths:
# - "**.po"
jobs:
update_translations:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.10"
- name: Update .po tiles
run: |
pip install Babel
set -x
pybabel update --input-file="${{ github.workspace }}/psychopy/localization/messages.pot" \
--output-dir="${{ github.workspace }}/psychopy/app/locale/"
- name: Compiling .mo files
run: |
set -x
for x in ${{ github.workspace }}/psychopy/app/locale/*/*/*.po ;\
do python3 .github/workflows/msgfmt.py --output-file "`dirname "$x"`/`basename "$x" .po`.mo" "$x" ; \
done
- name: Stage all changes
id: staging
run: |
ls -d ${{ github.workspace }}/psychopy/app/locale/*/*/*.mo \
| grep -v "/en_US/" | xargs git add .
echo "NUM_OF_STAGED=$(git diff --staged --name-only | wc -l)" >> $GITHUB_OUTPUT
- name: Push translation changes
if: steps.staging.outputs.NUM_OF_STAGED > 0
run: |
git config user.name github-actions
git config user.email github-actions@github.com
ls -d ${{ github.workspace }}/psychopy/app/locale/*/*/*.mo \
| grep -v "/en_US/" | xargs git add .
git commit -m "[bot] Docs: Update translations"
git push