|
| 1 | +name: Import Polish translation |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - agent/update-polish-translation |
| 7 | + workflow_dispatch: |
| 8 | + |
| 9 | +permissions: |
| 10 | + contents: write |
| 11 | + |
| 12 | +jobs: |
| 13 | + import: |
| 14 | + runs-on: ubuntu-latest |
| 15 | + steps: |
| 16 | + - uses: actions/checkout@v4 |
| 17 | + with: |
| 18 | + ref: agent/update-polish-translation |
| 19 | + fetch-depth: 0 |
| 20 | + |
| 21 | + - name: Reconstruct and validate translation |
| 22 | + shell: bash |
| 23 | + run: | |
| 24 | + set -euo pipefail |
| 25 | + cat .translation-import/plchunk*.b64 | base64 --decode | gzip --decompress > src/translations/qdomyos-zwift_pl.ts |
| 26 | + echo "7fa51748ae0a152a64c5928e0a07e70378d85a206ae12a37f52e3d0b336c03e2 src/translations/qdomyos-zwift_pl.ts" | sha256sum --check |
| 27 | + python3 - <<'PY' |
| 28 | + import xml.etree.ElementTree as ET |
| 29 | + path = 'src/translations/qdomyos-zwift_pl.ts' |
| 30 | + root = ET.parse(path).getroot() |
| 31 | + assert root.attrib.get('language') == 'pl_PL', root.attrib.get('language') |
| 32 | + messages = root.findall('.//message') |
| 33 | + translations = root.findall('.//translation') |
| 34 | + assert len(messages) == 1539, len(messages) |
| 35 | + assert len(translations) == 1539, len(translations) |
| 36 | + assert all((t.text or '').strip() for t in translations) |
| 37 | + assert not any(t.get('type') == 'unfinished' for t in translations) |
| 38 | + print('Polish translation validated:', len(messages), 'messages') |
| 39 | + PY |
| 40 | +
|
| 41 | + - name: Remove temporary import files |
| 42 | + shell: bash |
| 43 | + run: | |
| 44 | + rm -rf .translation-import |
| 45 | + rm -f .github/workflows/import-polish-translation.yml |
| 46 | +
|
| 47 | + - name: Commit final translation |
| 48 | + shell: bash |
| 49 | + run: | |
| 50 | + set -euo pipefail |
| 51 | + git config user.name "github-actions[bot]" |
| 52 | + git config user.email "41898282+github-actions[bot]@users.noreply.github.com" |
| 53 | + git add -A |
| 54 | + git commit -m "i18n: update Polish translation" |
| 55 | + git push origin HEAD:agent/update-polish-translation |
0 commit comments