xgettext [options] files
    xgettext -h

Solaris and GNU/Linux only. Extract messages (specially marked strings) from C and C++ source files. Place them in a “portable object” file (.po) for translation and compilation by msgfmt. By default, xgettext extracts strings only inside calls to the gettext (3C) and dgettext (3C) functions. Source files are named on the command line. A filename of - indicates the standard input. See also gettext and msgfmt.

GNU gettext extends the original Solaris gettext design and is able to extract strings from source files for a large number of languages. The URL for it is

Common Options

-a, --extract-all

Extract all strings, not just those in calls to gettext or dgettext. (GNU/Linux: applies to languages C, C++, ObjectiveC, Shell, Python, Lisp, EmacsLisp, librep, Scheme, Java, C#, awk, Tcl, Perl, PHP, GCC-source, and Glade.)

-ctag, --add-comments[=tag]

Copy source file comments marked with tag into the .po file as #-delimited comments.

-ddomain, --default-domain=domain

Use domain .po as the output file instead of messages.po.

-h, --help

Print a help message on the standard output.

-j, --join-existing

Join (merge) extracted messages with those in the current .po file. Domain directives in the existing .po file are ignored.

-mprefix, --msgstrr-prefix=prefix

Fill in each msgstr with prefix. Intended for debugging. The GNU version allows prefix to be optional.

-Msuffix, --msgstr-suffix=suffix

Fill in each msgstr with suffix

Get Unix in a Nutshell, 4th Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.