summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorScott Shawcroft <scott@adafruit.com>2021-01-11 15:29:50 -0800
committerGitHub <noreply@github.com>2021-01-11 15:29:50 -0800
commita92712acc573c206bbcd5adcc92d32b62f23df7e (patch)
treed0d93bfc2a3139539530087cfc951f50705b213a
parent3a7755b3118a1b6d5e0143ec401024f43e2e1d77 (diff)
parent288c54c70a8b6a6682ae9ac8c0a5483c3968d433 (diff)
Merge pull request #3949 from jepler/pre-commit-translations
pre-commit: Add check for translations being up to date
-rw-r--r--.github/workflows/pre-commit.yml4
-rw-r--r--.pre-commit-config.yaml7
-rw-r--r--Makefile2
-rw-r--r--locale/circuitpython.pot1
4 files changed, 12 insertions, 2 deletions
diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml
index 8caf56d26..af62072c8 100644
--- a/.github/workflows/pre-commit.yml
+++ b/.github/workflows/pre-commit.yml
@@ -15,6 +15,10 @@ jobs:
steps:
- uses: actions/checkout@v1
- uses: actions/setup-python@v1
+ - name: Install deps
+ run: sudo apt-get update && sudo apt-get install -y gettext
+ - name: Populate selected submodules
+ run: git submodule update --init extmod/ulab
- name: set PY
run: echo >>$GITHUB_ENV PY="$(python -c 'import hashlib, sys;print(hashlib.sha256(sys.version.encode()+sys.executable.encode()).hexdigest())')"
- uses: actions/cache@v1
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index 322f37da4..82d89eaa3 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -11,3 +11,10 @@ repos:
exclude: '^(tests/.*\.exp|tests/cmdline/.*|tests/.*/data/.*|ports/esp32s2/esp-idf-config/.*|ports/esp32s2/boards/.*/sdkconfig)'
- id: trailing-whitespace
exclude: '^(tests/.*\.exp|tests/cmdline/.*|tests/.*/data/.*)'
+- repo: local
+ hooks:
+ - id: translations
+ name: Check Translations
+ entry: sh -c "make translate"
+ language: system
+ always_run: true
diff --git a/Makefile b/Makefile
index a1807c308..adb206d7b 100644
--- a/Makefile
+++ b/Makefile
@@ -222,7 +222,7 @@ pseudoxml:
all-source:
locale/circuitpython.pot: all-source
- find $(TRANSLATE_SOURCES) -type d \( $(TRANSLATE_SOURCES_EXC) \) -prune -o -type f \( -iname "*.c" -o -iname "*.h" \) -print | (LC_ALL=C sort) | xgettext -f- -L C -s --add-location=file --keyword=translate -o circuitpython.pot -p locale
+ find $(TRANSLATE_SOURCES) -type d \( $(TRANSLATE_SOURCES_EXC) \) -prune -o -type f \( -iname "*.c" -o -iname "*.h" \) -print | (LC_ALL=C sort) | xgettext -f- -L C -s --add-location=file --keyword=translate -o - | sed -e '/"POT-Creation-Date: /d' > $@
# Historically, `make translate` updated the .pot file and ran msgmerge.
# However, this was a frequent source of merge conflicts. Weblate can perform
diff --git a/locale/circuitpython.pot b/locale/circuitpython.pot
index 3ca08b2a9..5d80207b6 100644
--- a/locale/circuitpython.pot
+++ b/locale/circuitpython.pot
@@ -8,7 +8,6 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2021-01-04 12:55-0600\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"