Skip to content

Surface all bundled languages in Language picker on Flatpak - #175

Merged
got3nks merged 1 commit into
amule-org:masterfrom
got3nks:fix/flatpak-language-picker-catalog-probe
Jun 16, 2026
Merged

Surface all bundled languages in Language picker on Flatpak#175
got3nks merged 1 commit into
amule-org:masterfrom
got3nks:fix/flatpak-language-picker-catalog-probe

Conversation

@got3nks

@got3nks got3nks commented Jun 16, 2026

Copy link
Copy Markdown

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

  • Local macOS build: picker unchanged, same languages as before the patch
  • Flatpak build on aarch64 (amule-dev-vm, GNOME Platform 50, flatpak-builder against this branch): picker now shows the full bundled set (Slovenian, Spanish, Swedish, Turkish, Ukrainian, etc. visible at the tail of the dropdown)
  • Selecting a non-glibc language (Italian) loads the correct catalog and translates the UI

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.
@got3nks
got3nks merged commit a6312c4 into amule-org:master Jun 16, 2026
10 checks passed
@got3nks
got3nks deleted the fix/flatpak-language-picker-catalog-probe branch June 16, 2026 12:46
got3nks added a commit that referenced this pull request Jun 16, 2026
Post-3.0.0 master tip after #176 (libatomic find_library widened to
accept libatomic.so.1, fixing 32-bit configure on openSUSE-class
distros). #175 (Language picker bundled-catalog probe) is also
folded in via the prior merges leading up to this SHA.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant