GTK locales¶
This utility will add the required changes to allow GTK applications to use the correct locale settings.
Usage with sc-jsonnet¶
Applying the utility with sc-jsonnet is the easiest method. To use, simply import the library and add gtk_locales() to your snapcraft tag. The following code shows a trivial example of using it:
local snapcraft = import 'snapcraft.libsonnet';
local gtk_locales = import 'https://raw.githubusercontent.com/diddlesnaps/snapcraft-utils-library/master/lib/gtk-locales.libsonnet';
snapcraft {
name: gtk-locales-example,
version: "0.1",
summary: "Example of using the 'gtk-locales' library",
description:
"
This is my-snap's description. You have a paragraph or two to tell the
most important story about your snap. Keep it under 100 words though,
we live in tweetspace and your description wants to look good in the snap
store.
",
base: core18,
# Add the rest of your snapcraft build config here
}
+ gtk_locales()
Manually adding to snapcraft.yaml¶
Add the following part into your snapcraft.yaml
, and change
my-part
to a list of all of your snap’s other parts:
parts:
gtk-locales:
after: [my-part] # Make this part run last
plugin: nil
build-packages:
- apt
- dpkg
override-pull: |
set -eux
apt download "language-pack-gnome-*-base"
override-build: |
set -eux
for deb in *.deb; do dpkg-deb -x $deb .; done
find usr/share/locale-langpack -type f -not -name "gtk30*.mo" -exec rm '{}' \;
mkdir -p "$SNAPCRAFT_PART_INSTALL/usr/share"
cp -R usr/share/locale-langpack "$SNAPCRAFT_PART_INSTALL/usr/share/"