It seems like snaps which depends on Gnome common snaps (e.g. gnome-42-2204
) cannot find libthai’s dictionary, which is required for Thai word-breaking to works. This affects applications from snapped gedit to Firefox [1].
Steps to reproduce:
- Install
gedit
snap from the store, and then open it. - Copy and paste the following text into
gedit
window [2]:
ตัดฉันทีตัดฉันทีตัดฉันทีตัดฉันทีตัดฉันทีตัดฉันทีตัดฉันที
word break word break word break word break
Resize the window down to force word break. Both lines should be broken into multiple lines. However, only the second line is broken; the first one isn’t. (If the second line also isn’t broken, check your gedit preference.)
If, however, I launch gedit
with:
LIBTHAI_DICTDIR=/snap/gedit/current/gnome-platform/usr/share/libthai/ /snap/bin/gedit
then the word breaking works as expected. A similar problem and a similar fix also applies to Firefox as well.
Using snap run --strace='--trace=%file'
shows that it’s trying to look for a dictionary at /usr/share/libthai
(i.e. host’s copy), which I understands is blocked by AppArmor for a reason (I can’t find the denial in the journal log though).
A workaround would be for every snap to put:
export LIBTHAI_DICTDIR=${SNAP}/gnome-platform/usr/share/libthai/
in snap’s launcher script. However, IMO applications shouldn’t be expected to set this environment variable. There should be a way for the gnome common snaps to provide this environment variable for all snaps that use these common snaps. I’m not sure how this would be possible though, so I start this thread to discuss possibilities to make this works for all snaps.
As a side note, Chromium seems to be an odd-one-out It also uses common snap (gnome-3-38-2004
, the same one as Firefox actually), but Thai word breaking works there. I’ve grep’ed the snap and it doesn’t seem to set LIBTHAI_DICTDIR
anyhow. strace even shows that it can’t open the dictionary either, so I’m not sure how it works there. Their word breaker don’t use libthai
?
[1] https://bugzilla.mozilla.org/show_bug.cgi?id=1796939 (also reported by me)
[2] For reference, “ตัด”, “ฉัน”, and “ที”, are 3 distinct words in Thai.