From 1d12b0addcf667c844076a10b3a6d3e32c367b4f Mon Sep 17 00:00:00 2001 From: Ned Zimmerman Date: Wed, 24 Nov 2021 20:26:29 -0400 Subject: [PATCH 1/2] ci: automatically commit updated POT files (#293) --- .github/workflows/update-pot.yml | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/.github/workflows/update-pot.yml b/.github/workflows/update-pot.yml index 4b13a54..5a453cd 100644 --- a/.github/workflows/update-pot.yml +++ b/.github/workflows/update-pot.yml @@ -20,18 +20,16 @@ jobs: tools: composer, wp-cli - name: Install dependencies run: | - wp package install wp-cli/i18n-command:2.2.6 - wp package install pressbooks/pb-cli:dev-dev#800cec8 + wp package install wp-cli/i18n-command:2.2.8 + cd /home/runner/.wp-cli/packages/ + composer config repositories.wp-cli '{"type": "composer","url": "https://wp-cli.org/package-index/","canonical": false}' + cd ./ + wp package install pressbooks/pb-cli:2.1.0 composer require jenssegers/blade:1.1.0 - name: Update POT file run: wp pb make-pot . languages/pressbooks-aldine.pot --require=vendor/autoload.php --domain=pressbooks-aldine --slug=pressbooks-aldine --package-name="Aldine" --headers="{\"Report-Msgid-Bugs-To\":\"https://github.com/pressbooks/pressbooks-aldine/issues\"}" - # Remove the next four lines and uncomment the last five lines once the process has been confirmed to work as desired. - - uses: actions/upload-artifact@v2 + - name: Commit updated POT file + uses: stefanzweifel/git-auto-commit-action@v4.1.1 with: - name: pressbooks-aldine.pot - path: languages/pressbooks-aldine.pot - # - name: Commit updated POT file - # uses: stefanzweifel/git-auto-commit-action@v4.1.1 - # with: - # commit_message: 'chore(l10n): update languages/pressbooks-aldine.pot' - # file_pattern: '*.pot' + commit_message: 'chore(l10n): update languages/pressbooks-aldine.pot' + file_pattern: '*.pot' From fbd81d68fb601bd589cf6bd9e7ae80a67b96076f Mon Sep 17 00:00:00 2001 From: Ned Zimmerman Date: Wed, 24 Nov 2021 20:32:56 -0400 Subject: [PATCH 2/2] ci: pull updated translation files on workflow dispatch (#294) * ci: pull updated translation files on workflow dispatch --- .github/workflows/update-translations.yml | 29 +++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 .github/workflows/update-translations.yml diff --git a/.github/workflows/update-translations.yml b/.github/workflows/update-translations.yml new file mode 100644 index 0000000..0e53d95 --- /dev/null +++ b/.github/workflows/update-translations.yml @@ -0,0 +1,29 @@ +name: Update translations from Transifex + +on: workflow_dispatch + +jobs: + update-translations: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Install Transifex Client + run: sudo pip install transifex-client + - name: Pull translations from Transifex + run: tx pull -a --minimum-perc=25 + env: + TX_TOKEN: ${{ secrets.TX_TOKEN }} + - name: Install xgettext + run: sudo apt-get install -y gettext + - name: Generate MO files + run: for file in languages/*.po ; do msgfmt $file -o `echo $file | sed 's/\(.*\.\)po/\1mo/'` ; done + # Remove the next four lines and uncomment the last six lines once the process has been confirmed to work as desired. + - uses: actions/upload-artifact@v2 + with: + name: pressbooks-aldine-languages + path: languages/ + # - name: Commit updated translation files + # uses: stefanzweifel/git-auto-commit-action@v4.1.1 + # with: + # commit_message: 'chore(l10n): update translations' + # file_pattern: *.mo *.po