|
- name: Internationalization check
-
- on:
- push:
- branches: [master, features]
- pull_request:
- branches: [master, features]
-
- jobs:
- internationalization:
- runs-on: ubuntu-latest
-
- steps:
- - uses: actions/checkout@v1
- - name: Set up Python
- uses: actions/setup-python@v1
- with:
- python-version: 3.8
- - name: Install dependencies
- run: |
- pip install --upgrade pip pipenv
- pipenv sync -d
- - name: Check i18n
- run: |
- pipenv run python setup.py extract_messages --output-file=/tmp/kosmorro-messages.pot > /dev/null
- diff=$(diff _kosmorro/locales/messages.pot /tmp/kosmorro-messages.pot | grep '^>')
- n=$(echo "$diff" | grep -v '> "POT-Creation-Date: ' | wc -l)
-
- if [ "$(echo "$diff" | grep -E '^"Generated-By: Babel' | wc -l)" -eq "1" ]; then
- echo "❌ You dependencies may be out of date!"
- echo " Please run the following command to fix this:"
- echo
- echo " pipenv sync --dev"
- echo
- echo " Then update the messages file:"
- echo
- echo " make messages"
- exit 2
- fi
-
- if [ "$n" -ne "0" ]; then
- echo "❌ The messages file is not up-to-date!"
- echo " Please run the following command to fix this:"
- echo
- echo " make messages"
- exit 1
- fi
-
- echo "✔ Messages file up-to-date."
|