1
0
mirror of https://github.com/google/comprehensive-rust.git synced 2025-01-12 23:48:27 +02:00

Diff translations on every PR (#2214)

This uses a new mode of `i18n-report` to summarise the differences in
translations as an action on each PR.
This commit is contained in:
Andrew Walbran 2024-07-13 12:26:16 +01:00 committed by GitHub
parent 19e0660505
commit d1b82a8e5c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 27 additions and 3 deletions

View File

@ -162,3 +162,27 @@ jobs:
env:
MDBOOK_BOOK__LANGUAGE: ${{ matrix.language }}
run: mdbook test
po-diff:
name: Translation diff
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Rust cache
uses: ./.github/workflows/setup-rust-cache
- name: Install mdbook
uses: ./.github/workflows/install-mdbook
- name: Copy latest version of translations
run: cp -r po old-po
- name: Checkout base version
run: git checkout ${{ github.event.pull_request.base.sha }}
- name: Translation diff
run: i18n-report diff old-po/ po/ > $GITHUB_STEP_SUMMARY

View File

@ -29,7 +29,7 @@ runs:
shell: bash
- name: Install i18n-report
run: cargo install i18n-report --locked --version 0.1.0
run: cargo install i18n-report --locked --version 0.2.0
shell: bash
- name: Install mdbook-exerciser

View File

@ -55,14 +55,14 @@ jobs:
done
- name: Build translation report
run: i18n-report book/html/translation-report.html po/*.po
run: i18n-report report book/html/translation-report.html po/*.po
- name: Build synced translation report
run: |
cp -r po synced-po
MDBOOK_OUTPUT='{"xgettext": {"pot-file": "messages.pot", "granularity": 0}}' mdbook build -d synced-po
for file in synced-po/*.po; do msgmerge --update $file synced-po/messages.pot ; done
i18n-report book/html/synced-translation-report.html synced-po/*.po
i18n-report report book/html/synced-translation-report.html synced-po/*.po
- name: Setup Pages
uses: actions/configure-pages@v5