How to translate a program installed by snap package?

For applications packaged as snaps, it may be necessary to make a change to the code so that it can find the translations in the correct location in the file system.

For applications and libraries which use gettext, this means that the call to bindtextdomain() needs to prepend the value of the $SNAP environment variable to the directory path passed in as the second argument. Any applications (and/or libraries they may be using) which don't do this, may indeed not have working translations, due to the hard-coded path being used pointing at a path outside of the snap.


As ToX 82 pointed out in a comment at Snap (snapcraft?) and translated apps, there is a bug report. This seems not to be an issue with the individual VLC snap, after all, but rather a general snap localization issue.