Skip to content

check-diff.py can't detect changes in long strings #91

Description

@ryonakano

What Happened?

check-diff.py that is used in gettext-template and gettext-flatpak can't detect changes in long strings—in concrete, strings that have no text in the msgid line. For example:

#: src/Application.vala:15
msgid ""
"• Applications can be managed with Flatpak. See `flatpak --help` or use "
"AppCenter"
msgstr ""

This is because the script ignores changes in the lines that begins with ":

if line.startswith ('-"'):
continue
if line.startswith ('+"'):
continue

I guess the above code exists to prevent unnecessary commit when just the file header (e.g. Project-Id-Version, etc.) is updated, but that is unexpectedly affected here.

Steps to Reproduce

  1. Change the following sentence in https://github.com/elementary/apt-shim/blob/d09f0aff23beefc831847f282a0b202442af8aed/src/Application.vala
    Before: APT can't be used to manage packages on this device because the system files are immutable
    After: APT can't be used to manage packages on this device because the system files are immutable!
  2. Run ninja -C builddir/ io.elementary.apt-shim-pot to update the translation template
  3. Run wget https://github.com/elementary/actions/raw/b6e5cba9fac00456f1075bfff13005ba7f7ac472/gettext-template/check-diff.py
  4. Run sed -i '8,21d' check-diff.py
    (Removes the code that pushes changes to the remote repository)
  5. Run python3 ./check-diff.py
  6. See the following output
Checking the repository for new translations...
The translations are up-to-date!
  1. Run git diff
  2. See the translation template file is surely changed
diff --git a/po/io.elementary.apt-shim.pot b/po/io.elementary.apt-shim.pot
index 928c628..1f5c360 100644
--- a/po/io.elementary.apt-shim.pot
+++ b/po/io.elementary.apt-shim.pot
@@ -8,7 +8,7 @@ msgid ""
 msgstr ""
 "Project-Id-Version: io.elementary.apt-shim\n"
 "Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2026-09-22 21:40+0900\n"
+"POT-Creation-Date: 2026-09-22 22:34+0900\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"
@@ -20,7 +20,7 @@ msgstr ""
 #: src/Application.vala:13
 msgid ""
 "APT can't be used to manage packages on this device because the system files "
-"are immutable"
+"are immutable!"
 msgstr ""

 #: src/Application.vala:15
diff --git a/src/Application.vala b/src/Application.vala
index 493968a..46d2e0a 100644
--- a/src/Application.vala
+++ b/src/Application.vala
@@ -10,7 +10,7 @@ public static int main (string[] args) {
     Intl.textdomain (Config.GETTEXT_PACKAGE);

     stdout.printf ("\n" +
-                   _("APT can't be used to manage packages on this device because the system files are immutable") + "\n" +
+                   _("APT can't be used to manage packages on this device because the system files are immutable!") + "\n" +
                    "\n" +
                    _("• Applications can be managed with Flatpak. See `flatpak --help` or use AppCenter") + "\n" +
                    _("• System updates can be managed with systemd-sysupdate. See `updatectl --help` or open System Settings and visit System") + "\n" +

Expected Behavior

Changes in strings that have no text in the msgid line should be detected as string change.

OS Version

Other Linux

OS Architecture

amd64 (on most hardwares)

Session Type

Secure Session (Wayland, This is the default)

Software Version

Early Access or Compiled from git

Log Output

Hardware Info

No response

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions