gettext command-line utility not looking up translations

Viewed 62

I'm trying to translate some strings using gettext from a shell script under Linux, but have had no success. For example the following always returns the untranslated string:

LC_MESSAGES=et_EE gettext iso_639-3 'Estonian, Standard'

I've tried setting many combinations of LC_ALL, LANG, LANGUAGE and LC_MESSAGES environment variables to et, et_EE, et_EE.UTF-8 or empty strings, but nothing seems to work, even when using a clear enviroment (e.g. with env -i LC_MESSAGES=et_EE).

Although gettext --help clearly shows that the standard search directory is /usr/share/locale, the respective translation files (e.g. iso_639-3.mo) are properly installed in under /usr/share/locale/et/LC_MESSAGES/ and locale-gen has properly been run, gettext does not seem to look for the translations from under /usr/share/locale/. Output from strace -f -e trace=%file has shown that gettext only tries to read /usr/lib/locale/locale-archive, /usr/lib/locale/et_EE/LC_MESSAGES and /usr/lib/locale/et/LC_MESSAGES, with the last two openat() system calls failing with ENOENT as those files don't exist.

I'm probably just doing something plain stupid and don't know how to use the gettext utility. What am I doing wrong? How to properly use the gettext tool?

0 Answers
Related