From e4129ecf00071a8b7b9f2b97f0522ba6bbeb0253 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Thu, 7 Jan 2021 14:40:11 -0600 Subject: [PATCH 1/5] Makefile: Remove POT-Creation-Date from circuitpython.pot This line is only a magnet for conflicts; the date that circuitpython.pot was modified can be extracted from git metadata. Additionally, when we add "make translate" checking to pre-commit, this will avoid spurious changes since the most straightforward implementation would otherwise update this line every time pre-commit executed. --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index a1807c308f..adb206d7bc 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 From e79ee785ac45abc1ee53d9cdbfd30f2290ee7bd9 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Thu, 7 Jan 2021 14:40:51 -0600 Subject: [PATCH 2/5] circuitpython.pot: regenerate without timestamp --- locale/circuitpython.pot | 1 - 1 file changed, 1 deletion(-) diff --git a/locale/circuitpython.pot b/locale/circuitpython.pot index f319b82f8b..63dc92d18a 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 \n" "Language-Team: LANGUAGE \n" From 1dda33dc418cae1a0047df0241762ebdb3d87e8a Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Thu, 7 Jan 2021 14:41:11 -0600 Subject: [PATCH 3/5] pre-commit: Add checking of 'make translate' status .. when this check completes with an error, circuitpython.pot has been updated and the changes can be staged. --- .pre-commit-config.yaml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 322f37da46..82d89eaa3e 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 From 96dd3d3fef30ce632312ba592b84e2b9f5d84399 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Fri, 8 Jan 2021 18:21:27 -0600 Subject: [PATCH 4/5] ensure gettext program is available to pre-commit --- .github/workflows/pre-commit.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml index 8caf56d268..20c76c1249 100644 --- a/.github/workflows/pre-commit.yml +++ b/.github/workflows/pre-commit.yml @@ -15,6 +15,8 @@ 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: 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 From 288c54c70a8b6a6682ae9ac8c0a5483c3968d433 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Fri, 8 Jan 2021 18:54:02 -0600 Subject: [PATCH 5/5] need to find strings in ulab --- .github/workflows/pre-commit.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml index 20c76c1249..af62072c89 100644 --- a/.github/workflows/pre-commit.yml +++ b/.github/workflows/pre-commit.yml @@ -17,6 +17,8 @@ jobs: - 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