This launcher fixes Glibc locales support and allows snapped application to work properly in a non-English locale.
How to use
Merge the following snapcraft part recipe:
# Launcher for fixing the Glibc locales
# https://forum.snapcraft.io/t/the-locales-launch-launcher-fix-glibc-locales-in-the-snap-runtime/10296
locales-launch:
source: https://github.com/brlin-tw/locales-launch.git
source-tag: v1.0.0
plugin: dump
stage-packages:
# For localedef(1)
- libc-bin
# For locale data used by localedef(1)
- locales
# All pre-generated locale data
# DISABLED: Lots of duplicate data will be included in the snap when this is staged unless
# the target machine has no resource to generate them in runtime otherwise not use it
#
# Lack of compiled locales breaks gettext based localization - snapcraft - snapcraft.io
# https://forum.snapcraft.io/t/lack-of-compiled-locales-breaks-gettext-based-localisation/3758
#
#- locales-all
stage:
- bin/locales-launch
- etc/locale.alias
- usr/bin/localedef
- usr/share/doc/locales
- usr/share/i18n
- usr/share/locale
In the apps
stanza, insert bin/locales-launch
into the command chain:
apps:
_app_name_:
# The command to run the application, the value should be a *relative path* to an executable file rooted from the `prime` directory
command: bin/locales-launch "${SNAP}"/bin/_app_command_
if you’re using the full
adapter:
apps:
_app_name_:
# The environment adapter style to use, `command-chain` is only supported
adapter: full
# The command to run the application, the value should be a *relative path* to an executable file rooted from the `prime` directory
command: bin/_app_command_
command-chain:
- bin/locales-launch
Snaps that use this launcher
- brlin-tw/hello-snap: Unofficial Snap Packaging for GNU Hello - patch - patch that uses the
full
adapter - htop (maxiberta/htop-snap): The
htop
utility packaged as a snap - patch
The implementation
brlin-tw/locales-launch: A stage snap that fixes Glibc locales support
Happy snapcrafting!