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 .
Steps to reproduce:
geditsnap from the store, and then open it.
- Copy and paste the following text into
ตัดฉันทีตัดฉันทีตัดฉันทีตัดฉันทีตัดฉันทีตัดฉันทีตัดฉันที 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
then the word breaking works as expected. A similar problem and a similar fix also applies to Firefox as well.
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:
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
 https://bugzilla.mozilla.org/show_bug.cgi?id=1796939 (also reported by me)
 For reference, “ตัด”, “ฉัน”, and “ที”, are 3 distinct words in Thai.