From e5a16a9c8fbc8b1fadf207633644c48abae0554b Mon Sep 17 00:00:00 2001 From: Martin Geisler Date: Tue, 10 Jan 2023 15:00:20 +0100 Subject: [PATCH] Test that a no-op translation does nothing MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This ensures that the full mdbook-xgettext and mdbook-gettext workflow is stable and doesn’t include spurious newlines. --- .github/workflows/build.yml | 43 +++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d9dcb9ac7a3a..37f8c8d312cd 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -44,6 +44,49 @@ jobs: run: cargo test working-directory: i18n-helpers + i18n-helpers: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Setup Rust cache + uses: Swatinem/rust-cache@v2 + + - name: Install Gettext + run: sudo apt install gettext + + - name: Install mdbook + run: cargo install mdbook --version 0.4.25 + + - name: Install mdbook-svgbob + run: cargo install mdbook-svgbob --version 0.2.1 + + - name: Install i18n-helpers + run: cargo install --path i18n-helpers --locked + + - name: Generate po/messages.pot + run: mdbook build -d po + env: + MDBOOK_OUTPUT: '{"xgettext": {}}' + + - name: Test messages.pot + run: msgfmt --statistics -o /dev/null po/messages.pot + + - name: Expand includes without translation + run: mdbook build -d expanded + env: + MDBOOK_OUTPUT: '{"markdown": {}}' + + - name: Expand includes with no-op translation + run: mdbook build -d no-op + env: + MDBOOK_OUTPUT: '{"markdown": {}}' + MDBOOK_PREPROCESSOR__GETTEXT__PO_FILE: po/messages.pot + + - name: Compare no translation to no-op translation + run: diff -r expanded no-op + translations: runs-on: ubuntu-latest strategy: