I am creating a bash script for a very specific project, and the strings must be translatable.
I have successfully followed the following tutorial: gettext support for bash scripts:
http://mywiki.wooledge.org/BashFAQ/098
However, part of the tutorial asks to run the msgfmt command to generate compiled .mo files for each language. To make it work, I had to run the command as root and the .mo files are saved under /usr/share/locale/(lang)/LC_MESSAGES.
I'd like the .mo files to be saved in a sub-directory relative to the bash script, which is easy enough. But then, when the script is run, bash has to know what is must look for the .mo files in the appropriate, custom location.
How to achieve this?
What I am trying to do is to have the whole project, together with .pot and .mo files, self-contained and be able to update the translations without having to use sudo.
Did you play with environment variable TEXTDOMAINDIR
You could maybe find more informations in info
pages than in man
page:
info gettext
or
info gettext 'Variable Index'