Skip to content

Fix GTK translation detection missing Ubuntu locale-langpack paths#2380

Open
dsblank wants to merge 1 commit into
gramps-project:maintenance/gramps61from
dsblank:fix/gtk-locale-path
Open

Fix GTK translation detection missing Ubuntu locale-langpack paths#2380
dsblank wants to merge 1 commit into
gramps-project:maintenance/gramps61from
dsblank:fix/gtk-locale-path

Conversation

@dsblank

@dsblank dsblank commented Jun 13, 2026

Copy link
Copy Markdown
Member

Summary

On Ubuntu, GTK translations installed via language-pack-gnome-* live in
/usr/share/locale-langpack, not in the Python prefix's share/locale.
When running Gramps from a virtualenv or conda environment,
gettext.find('gtk30') searches only the Python prefix and returns None,
causing a spurious "GTK translations missing" warning dialog even when
the translations are correctly installed.

Replace the single gettext.find(GTK_GETTEXT_DOMAIN) call in
grampsgui.py with a _gtk_translations_found() helper that searches:

  • every directory in XDG_DATA_DIRS (the standard freedesktop path list)
  • /usr/share/locale-langpack (Ubuntu-specific fallback)

This silences the false-positive warning for users who have GTK
translations installed via the normal Ubuntu package manager.

Test plan

  • On Ubuntu with language-pack-gnome-en (or any language pack)
    installed, run Gramps from source (python3 Gramps.py) and confirm
    no "GTK translations missing" warning appears on startup.
  • Remove all language-pack-gnome-* packages and confirm the warning
    still appears correctly.
  • Confirm the fix has no effect on non-Linux platforms (the warning is
    already guarded by lin()).

🤖 Generated with Claude Code

Python's gettext.find() searches only the Python prefix's share/locale,
which does not include system locale directories when running from a
virtualenv or conda environment.  On Ubuntu, GTK translations installed
via language-pack-gnome-* live in /usr/share/locale-langpack, which is
never checked by the default search.

Replace the single gettext.find(GTK_GETTEXT_DOMAIN) call with a helper
_gtk_translations_found() that searches every directory listed in
XDG_DATA_DIRS plus /usr/share/locale-langpack, preventing a spurious
"GTK translations missing" warning for users who have the translations
installed via the normal Ubuntu package.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@dsblank dsblank added this to the v6.1 milestone Jun 13, 2026
@Nick-Hall

Copy link
Copy Markdown
Member

This approach may actually work with the Snap package removing the need to exclude it.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants