Fix GTK translation detection missing Ubuntu locale-langpack paths#2380
Open
dsblank wants to merge 1 commit into
Open
Fix GTK translation detection missing Ubuntu locale-langpack paths#2380dsblank wants to merge 1 commit into
dsblank wants to merge 1 commit into
Conversation
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>
Member
|
This approach may actually work with the Snap package removing the need to exclude it. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
On Ubuntu, GTK translations installed via
language-pack-gnome-*live in/usr/share/locale-langpack, not in the Python prefix'sshare/locale.When running Gramps from a virtualenv or conda environment,
gettext.find('gtk30')searches only the Python prefix and returnsNone,causing a spurious "GTK translations missing" warning dialog even when
the translations are correctly installed.
Replace the single
gettext.find(GTK_GETTEXT_DOMAIN)call ingrampsgui.pywith a_gtk_translations_found()helper that searches: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
language-pack-gnome-en(or any language pack)installed, run Gramps from source (
python3 Gramps.py) and confirmno "GTK translations missing" warning appears on startup.
language-pack-gnome-*packages and confirm the warningstill appears correctly.
already guarded by
lin()).🤖 Generated with Claude Code