Skip to content

Linux + iPhone Continuity / iMessage / SMS

fix: fuzzy translated string

Zack Bartele65bf14b437d
diff --git a/.github/workflows/i18n.yml b/.github/workflows/i18n.yml
index cc45082..33efcf2 100644
--- a/.github/workflows/i18n.yml
+++ b/.github/workflows/i18n.yml
@@ -5,9 +5,9 @@ on:
branches: [main, develop]
pull_request:
-# The per-catalog `msgfmt --check-format` run rides along with ctest in build.yml.
-# This job covers what that cannot see: a source string added without re-extracting
-# the template, and a catalog left incomplete.
+# Both gates also run under ctest in build.yml; this job re-runs them on a clean
+# checkout so a contributor who never ran the suite locally still can't merge a
+# stale template or an incomplete catalog.
jobs:
catalogs:
runs-on: ubuntu-latest
@@ -17,31 +17,8 @@ jobs:
- name: dependencies
run: sudo apt-get update && sudo apt-get install -y --no-install-recommends gettext
- # Compare through this runner's own msgcat. Wrapping and ordering differ
- # between gettext versions, and the header carries a timestamp and the
- # release version; none of that is what this gate asserts.
- name: pot is up to date
- run: |
- cp po/tether.pot /tmp/pot.committed
- make pot
- norm() { msgcat --sort-output --no-location "$1" | grep -vE '^"(POT-Creation-Date|Project-Id-Version):'; }
- if ! diff -u <(norm /tmp/pot.committed) <(norm po/tether.pot); then
- echo "::error::po/tether.pot is stale. Run 'make pot' and commit the result."
- exit 1
- fi
+ run: po/update-pot.sh --check
- name: catalogs are complete
- run: |
- fail=0
- while read -r lang; do
- [ -n "$lang" ] || continue
- out=$(msgfmt --check --check-format --statistics -o /dev/null "po/$lang.po" 2>&1) || fail=1
- case "$out" in
- *untranslated*|*fuzzy*)
- echo "::error file=po/$lang.po::$out"
- fail=1
- ;;
- *) echo "$lang: $out" ;;
- esac
- done < po/LINGUAS
- exit $fail
+ run: po/check-catalogs.sh
diff --git a/po/check-catalogs.sh b/po/check-catalogs.sh
new file mode 100755
index 0000000..b7de372
--- /dev/null
+++ b/po/check-catalogs.sh
@@ -0,0 +1,27 @@
+#!/bin/sh
+# Every catalog in LINGUAS must compile clean and be fully translated. A fuzzy or
+# untranslated entry ships English text to a translated desktop, so it fails here
+# rather than in CI.
+cd "$(dirname "$0")/.."
+
+annotate() {
+ if [ -n "$GITHUB_ACTIONS" ]; then
+ echo "::error file=po/$1.po::$2"
+ else
+ echo "po/$1.po: $2" >&2
+ fi
+}
+
+fail=0
+while read -r lang; do
+ [ -n "$lang" ] || continue
+ out=$(msgfmt --check --check-format --statistics -o /dev/null "po/$lang.po" 2>&1) || fail=1
+ case "$out" in
+ *untranslated*|*fuzzy*)
+ annotate "$lang" "$out"
+ fail=1
+ ;;
+ *) echo "$lang: $out" ;;
+ esac
+done < po/LINGUAS
+exit $fail
diff --git a/po/cs.po b/po/cs.po
index 31ce2b7..f63f46c 100644
--- a/po/cs.po
+++ b/po/cs.po
@@ -883,9 +883,8 @@ msgid "Reply"
msgstr "Odpovědět"
#: src/daemon/notification.cpp
-#, fuzzy
msgid "Copy Code"
-msgstr "Kopírovat příkazy"
+msgstr "Kopírovat kód"
#: src/gtk/daemon_client.cpp
msgid "Daemon Offline"
diff --git a/po/de.po b/po/de.po
index 52ac45d..592b879 100644
--- a/po/de.po
+++ b/po/de.po
@@ -902,9 +902,8 @@ msgid "Reply"
msgstr "Antworten"
#: src/daemon/notification.cpp
-#, fuzzy
msgid "Copy Code"
-msgstr "Befehle kopieren"
+msgstr "Code kopieren"
#: src/gtk/daemon_client.cpp
msgid "Daemon Offline"
diff --git a/po/es.po b/po/es.po
index 28188a8..855ab3a 100644
--- a/po/es.po
+++ b/po/es.po
@@ -895,9 +895,8 @@ msgid "Reply"
msgstr "Responder"
#: src/daemon/notification.cpp
-#, fuzzy
msgid "Copy Code"
-msgstr "Copiar comandos"
+msgstr "Copiar código"
#: src/gtk/daemon_client.cpp
msgid "Daemon Offline"
diff --git a/po/fr.po b/po/fr.po
index f189976..ca5433b 100644
--- a/po/fr.po
+++ b/po/fr.po
@@ -900,9 +900,8 @@ msgid "Reply"
msgstr "Répondre"
#: src/daemon/notification.cpp
-#, fuzzy
msgid "Copy Code"
-msgstr "Copier les commandes"
+msgstr "Copier le code"
#: src/gtk/daemon_client.cpp
msgid "Daemon Offline"
diff --git a/po/it.po b/po/it.po
index 525be2e..90b55f2 100644
--- a/po/it.po
+++ b/po/it.po
@@ -894,9 +894,8 @@ msgid "Reply"
msgstr "Rispondi"
#: src/daemon/notification.cpp
-#, fuzzy
msgid "Copy Code"
-msgstr "Copia i comandi"
+msgstr "Copia codice"
#: src/gtk/daemon_client.cpp
msgid "Daemon Offline"
diff --git a/po/ja.po b/po/ja.po
index ef0c2d2..8d5665f 100644
--- a/po/ja.po
+++ b/po/ja.po
@@ -866,9 +866,8 @@ msgid "Reply"
msgstr "返信"
#: src/daemon/notification.cpp
-#, fuzzy
msgid "Copy Code"
-msgstr "コマンドをコピー"
+msgstr "コードをコピー"
#: src/gtk/daemon_client.cpp
msgid "Daemon Offline"
diff --git a/po/ko.po b/po/ko.po
index ccb6bf7..6dc9b78 100644
--- a/po/ko.po
+++ b/po/ko.po
@@ -860,9 +860,8 @@ msgid "Reply"
msgstr "답장"
#: src/daemon/notification.cpp
-#, fuzzy
msgid "Copy Code"
-msgstr "명령 복사"
+msgstr "코드 복사"
#: src/gtk/daemon_client.cpp
msgid "Daemon Offline"
diff --git a/po/nl.po b/po/nl.po
index 1058be5..a57fa0f 100644
--- a/po/nl.po
+++ b/po/nl.po
@@ -889,9 +889,8 @@ msgid "Reply"
msgstr "Antwoorden"
#: src/daemon/notification.cpp
-#, fuzzy
msgid "Copy Code"
-msgstr "Opdrachten kopiëren"
+msgstr "Code kopiëren"
#: src/gtk/daemon_client.cpp
msgid "Daemon Offline"
diff --git a/po/pl.po b/po/pl.po
index 0be3e51..0fdf4dc 100644
--- a/po/pl.po
+++ b/po/pl.po
@@ -892,9 +892,8 @@ msgid "Reply"
msgstr "Odpowiedz"
#: src/daemon/notification.cpp
-#, fuzzy
msgid "Copy Code"
-msgstr "Kopiuj polecenia"
+msgstr "Kopiuj kod"
#: src/gtk/daemon_client.cpp
msgid "Daemon Offline"
diff --git a/po/pt_BR.po b/po/pt_BR.po
index 61af4ce..acd1615 100644
--- a/po/pt_BR.po
+++ b/po/pt_BR.po
@@ -889,9 +889,8 @@ msgid "Reply"
msgstr "Responder"
#: src/daemon/notification.cpp
-#, fuzzy
msgid "Copy Code"
-msgstr "Copiar comandos"
+msgstr "Copiar código"
#: src/gtk/daemon_client.cpp
msgid "Daemon Offline"
diff --git a/po/ru.po b/po/ru.po
index 951c185..4bfd0a9 100644
--- a/po/ru.po
+++ b/po/ru.po
@@ -891,9 +891,8 @@ msgid "Reply"
msgstr "Ответить"
#: src/daemon/notification.cpp
-#, fuzzy
msgid "Copy Code"
-msgstr "Скопировать команды"
+msgstr "Скопировать код"
#: src/gtk/daemon_client.cpp
msgid "Daemon Offline"
diff --git a/po/sv.po b/po/sv.po
index 3bc4709..a2b21bb 100644
--- a/po/sv.po
+++ b/po/sv.po
@@ -878,9 +878,8 @@ msgid "Reply"
msgstr "Svara"
#: src/daemon/notification.cpp
-#, fuzzy
msgid "Copy Code"
-msgstr "Kopiera kommandon"
+msgstr "Kopiera kod"
#: src/gtk/daemon_client.cpp
msgid "Daemon Offline"
diff --git a/po/tr.po b/po/tr.po
index 2a2934e..e6965d8 100644
--- a/po/tr.po
+++ b/po/tr.po
@@ -877,9 +877,8 @@ msgid "Reply"
msgstr "Yanıtla"
#: src/daemon/notification.cpp
-#, fuzzy
msgid "Copy Code"
-msgstr "Komutları kopyala"
+msgstr "Kodu kopyala"
#: src/gtk/daemon_client.cpp
msgid "Daemon Offline"
diff --git a/po/uk.po b/po/uk.po
index 2203b8d..76d887a 100644
--- a/po/uk.po
+++ b/po/uk.po
@@ -888,9 +888,8 @@ msgid "Reply"
msgstr "Відповісти"
#: src/daemon/notification.cpp
-#, fuzzy
msgid "Copy Code"
-msgstr "Скопіювати команди"
+msgstr "Скопіювати код"
#: src/gtk/daemon_client.cpp
msgid "Daemon Offline"
diff --git a/po/update-pot.sh b/po/update-pot.sh
index 748551d..924b5e0 100755
--- a/po/update-pot.sh
+++ b/po/update-pot.sh
@@ -1,8 +1,14 @@
#!/bin/sh
# Regenerate po/tether.pot from the sources in POTFILES.in and merge it into
# every catalog listed in LINGUAS. Run from the repository root, or via `make pot`.
+#
+# With --check nothing is written: the run only reports whether the committed pot
+# still matches the sources, so a test can catch a string added without `make pot`.
set -e
+check_only=0
+[ "$1" = "--check" ] && check_only=1
+
cd "$(dirname "$0")/.."
# The release version, not `git describe`: a commit count and hash would make the
@@ -47,6 +53,35 @@ if [ -f po/tether.pot ]; then
pot_changed=0
fi
fi
+if [ "$check_only" -eq 1 ]; then
+ missing=""
+ while read -r lang; do
+ [ -n "$lang" ] || continue
+ [ -f "po/$lang.po" ] || missing="$missing $lang"
+ done < po/LINGUAS
+
+ # Compare through msgcat rather than the byte-for-byte cmp above: this runs on
+ # machines other than the one that regenerated the pot, and wrapping and entry
+ # order differ between gettext versions.
+ if [ ! -f po/tether.pot ]; then
+ echo "po/tether.pot is missing. Run 'make pot' and commit the result." >&2
+ exit 1
+ fi
+ norm() { msgcat --sort-output --no-location "$1" | grep -vE '^"(POT-Creation-Date|Project-Id-Version):'; }
+ norm po/tether.pot > "$OLD_STRIPPED"
+ norm "$NEW" > "$NEW_STRIPPED"
+ if ! diff -u "$OLD_STRIPPED" "$NEW_STRIPPED"; then
+ echo "po/tether.pot is stale. Run 'make pot' and commit the result." >&2
+ exit 1
+ fi
+ if [ -n "$missing" ]; then
+ echo "no catalog for:$missing. Run 'make pot' and commit the result." >&2
+ exit 1
+ fi
+ echo "po/tether.pot is up to date; $(wc -l < po/LINGUAS) catalogs present"
+ exit 0
+fi
+
[ "$pot_changed" -eq 0 ] || cp "$NEW" po/tether.pot
while read -r lang; do
diff --git a/po/zh_CN.po b/po/zh_CN.po
index f0ae8e4..6dc39bd 100644
--- a/po/zh_CN.po
+++ b/po/zh_CN.po
@@ -839,9 +839,8 @@ msgid "Reply"
msgstr "回复"
#: src/daemon/notification.cpp
-#, fuzzy
msgid "Copy Code"
-msgstr "复制命令"
+msgstr "复制验证码"
#: src/gtk/daemon_client.cpp
msgid "Daemon Offline"
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
index 0a19bcd..96e110e 100644
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -35,14 +35,13 @@ target_link_libraries(tether_test PRIVATE
include(GoogleTest)
gtest_discover_tests(tether_test)
+# The same gates the i18n workflow runs, so a missing translation fails here first.
find_program(MSGFMT_EXECUTABLE msgfmt)
if(MSGFMT_EXECUTABLE)
- file(STRINGS "${CMAKE_SOURCE_DIR}/po/LINGUAS" TETHER_LINGUAS)
- foreach(LANG ${TETHER_LINGUAS})
- if(EXISTS "${CMAKE_SOURCE_DIR}/po/${LANG}.po")
- add_test(NAME po_${LANG}
- COMMAND ${MSGFMT_EXECUTABLE} --check --check-format
- -o /dev/null "${CMAKE_SOURCE_DIR}/po/${LANG}.po")
- endif()
- endforeach()
+ add_test(NAME po_catalogs COMMAND "${CMAKE_SOURCE_DIR}/po/check-catalogs.sh")
+endif()
+
+find_program(XGETTEXT_EXECUTABLE xgettext)
+if(XGETTEXT_EXECUTABLE)
+ add_test(NAME po_template COMMAND "${CMAKE_SOURCE_DIR}/po/update-pot.sh" --check)
endif()