Release 0.43.1 #685
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: update_locales | |
| on: pull_request | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| permissions: {} | |
| jobs: | |
| update_locales: | |
| # Skip for forks which have no access to secrets (PAT) | |
| if: github.event.pull_request.head.repo.fork == false | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - uses: actions/setup-python@v6 | |
| with: | |
| python-version: '3.x' | |
| check-latest: true | |
| - name: Install dependencies | |
| run: | | |
| python3 -m pip install --upgrade pip setuptools | |
| python3 -m pip install --upgrade babel jinja2 | |
| sudo apt-get -q update | |
| sudo DEBIAN_FRONTEND='noninteractive' apt-get -qq --no-install-recommends install gettext | |
| - uses: actions/checkout@v6 | |
| with: | |
| ref: ${{ github.head_ref }} | |
| # https://github.com/peter-evans/create-pull-request/issues/48 | |
| token: ${{ secrets.GH_PAT }} | |
| - name: Generate backend template | |
| run: | | |
| pybabel extract -F l10n/babel.cfg -o motioneye/locale/motioneye.pot motioneye/ | |
| # Remove trailing empty line to satisfy pre-commit | |
| sed -i '${/^$/d}' motioneye/locale/motioneye.pot | |
| - name: Generate frontend template | |
| run: xgettext --no-wrap --from-code=UTF-8 -o motioneye/locale/motioneye.js.pot motioneye/static/js/*.js l10n/*.js | |
| - name: Generate frontend locales | |
| run: | | |
| rm motioneye/static/js/motioneye.*.json | |
| for i in motioneye/locale/*/LC_MESSAGES/motioneye.js.po | |
| do | |
| lang=${i#motioneye/locale/} | |
| lang=${lang%/LC_MESSAGES/motioneye.js.po} | |
| echo "Generating motioneye.$lang.json" | |
| l10n/po2json "$i" "motioneye/static/js/motioneye.$lang.json" | |
| done | |
| - name: Cleanup backend locales | |
| run: | | |
| for i in motioneye/locale/*/LC_MESSAGES/motioneye.mo | |
| do | |
| [ -f "${i%mo}po" ] || rm "$i" | |
| done | |
| - name: Commit changes | |
| run: | | |
| git add -A | |
| git diff -I '^"POT-Creation-Date: ' --exit-code HEAD && exit 0 | |
| git config user.name 'github-actions[bot]' | |
| git config user.email 'github-actions[bot]@users.noreply.github.com' | |
| git commit -m 'Update translation files' | |
| git push |