I know how to translate a natural language message into the user's language using gettext.
But now I am wondering how to obtain a list of all translatable messages in a given domain.
I have obtained a raw result with something like this:
strings /usr/share/locale/${LANG:0:2}/LC_MESSAGES/$DOMAIN.mo
but I am looking for a neater solution.
The
xgettext
program extracts translatable strings from.po
files, which are the source files for the.mo
files found in/usr/share/locale
. These.po
files should be included in the source distribution of the package for which you want to translate messages.If you need to work with
.mo
files, you can translate them back to.po
withmsgunfmt
.