Skip to content

Commit

Permalink
Diff translations on every PR (#2214)
Browse files Browse the repository at this point in the history
This uses a new mode of `i18n-report` to summarise the differences in
translations as an action on each PR.
  • Loading branch information
qwandor committed Jul 13, 2024
1 parent 19e0660 commit d1b82a8
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 3 deletions.
24 changes: 24 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion .github/workflows/install-mdbook/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit d1b82a8

Please sign in to comment.