-
Notifications
You must be signed in to change notification settings - Fork 56
60 lines (55 loc) · 2 KB
/
update-l10n-sources.yml
File metadata and controls
60 lines (55 loc) · 2 KB
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
53
54
55
56
57
58
59
60
name: update-l10n-sources
on:
push:
branches: [master]
jobs:
update-l10n-sources:
runs-on: ubuntu-latest
steps:
- name: Checkout 🛎️
uses: actions/checkout@v6
with:
token: ${{ secrets.PAT }}
- name: Setup Python 🐍
uses: actions/setup-python@v6
with:
python-version: "3.13"
- name: Restore pip cache 💾
uses: actions/cache@v5
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Install Babel ⚙️
run: |
pip3 install -U pip
pip3 install Babel==2.9.0
- name: Update localization source file 📄
run: |
pybabel extract bot.py pdf_bot/ -o locale/pdf_bot.pot
pybabel update -l locale -i locale/pdf_bot.pot -o locale/en_GB/LC_MESSAGES/pdf_bot.po
echo NUM_DIFFS=$(git diff --shortstat | egrep -o '[0-9]+ i' | egrep -o '[0-9]+') >> $GITHUB_ENV
- name: Commit changes 🆕
if: env.NUM_DIFFS > 1
uses: stefanzweifel/git-auto-commit-action@v7
with:
commit_message: Update localization source file
file_pattern: locale/en_GB/LC_MESSAGES/pdf_bot.po
push_options: --force
- name: Upload sources and download translations 🌐
if: env.NUM_DIFFS > 1
uses: crowdin/github-action@v2.15.0
with:
upload_sources: true
upload_translations: false
download_translations: true
create_pull_request: true
pull_request_labels: "automerge, l10n"
config: ./crowdin.yml
source: locale/en_GB/LC_MESSAGES/pdf_bot.po
translation: /locale/%locale_with_underscore%/LC_MESSAGES/pdf_bot.po
env:
GITHUB_TOKEN: ${{ secrets.GIT_HUB_TOKEN }}
CROWDIN_PROJECT_ID: ${{ secrets.CROWDIN_PROJECT_ID }}
CROWDIN_PERSONAL_TOKEN: ${{ secrets.CROWDIN_PERSONAL_TOKEN }}