Surface all bundled languages in Language picker on Flatpak - #175
Merged
got3nks merged 1 commit intoJun 16, 2026
Merged
Conversation
The Language dropdown in Preferences only showed the user's active glibc locale plus en_US / en_GB when running inside Flatpak (cardpuncher on the 3.0.0-151-g78f62c053 flatpak-x86_64 build, amule-org#18 follow-up). Root cause: the picker probe at Preferences.cpp gates each candidate language behind wxLocale::IsAvailable() and a locale_to_check.IsOk() check, both of which require glibc-locale data for that language to be present in the runtime. The GNOME Flatpak runtime ships only the user's preferred locale via the org.freedesktop.Platform.Locale extension; every other language fails the probe even though our amule.mo catalogs are bundled correctly at /app/share/locale/<lang>/LC_MESSAGES/amule.mo (verified via ostree on the .flatpak bundle). glibc-locale-data is only needed for LC_NUMERIC / LC_TIME formatting, not for translation lookup. wxLocale can apply the amule.mo catalog via the install-prefix path registered in InitLocale (PR amule-project#22) without glibc-locale-data for the target language. Add a HasAMuleCatalogForLanguage() helper that checks for our .mo file under the same lookup prefixes InitLocale registers (GetResourcesDir/locale on Mac/Windows, GetInstallPrefix/share/locale on Linux/*BSD). Accept that as an additional positive signal in both gates of the probe so languages whose catalog file is on disk surface in the picker regardless of sandbox glibc state. On system installs where glibc has the locales the behaviour is unchanged: the existing checks pass first and the file-existence test is never reached.
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
Follow-up to #18. cardpuncher reported on the 3.0.0-151-g78f62c053 flatpak-x86_64 build that the Preferences → General → Language dropdown only listed their active glibc locale plus `English (U.K.)` / `English (U.S.)`, even though all 41 `amule.mo` catalogs are bundled into the Flatpak (verified via ostree on the `.flatpak`, and the GUI itself runs correctly translated once `LANG=` is set externally).
Root cause is in the picker probe in Preferences.cpp: each candidate language is gated behind `wxLocale::IsAvailable()` and a subsequent `wxLocale::IsOk()` check. Both require glibc locale data for that specific language inside the sandbox. The GNOME runtime ships locale data only for the user's preferred locale via `org.freedesktop.Platform.Locale`, so every other language fails the probe regardless of whether our translation catalog is present.
glibc locale data is only needed for `LC_NUMERIC` / `LC_TIME` formatting, not for translation lookup. `wxLocale` can apply our `amule.mo` catalog via the install-prefix path registered in `InitLocale()` (added in #22) without locale data for the target language.
This adds a `HasAMuleCatalogForLanguage()` helper that probes for `amule.mo` under the same lookup prefixes `InitLocale()` registers (`GetResourcesDir/locale` on macOS/Windows, `GetInstallPrefix/share/locale` on Linux/*BSD) and accepts that as an additional positive signal in both gates of the picker probe. On system installs where glibc already has the locales, the existing checks pass first and the file-existence test is never reached, so there is no behaviour change on Mac, Windows, or native Linux packages.
Test plan