pygettext2.11
Python equivalent of xgettext(1)
Usage
pygettext [OPTIONS]
INPUTFILE ...
Overview
pygettext uses Python's standard tokenize module to scan Python source code, generating .pot files identical to what GNU xgettext generates for C and C++ code. From there, the standard GNU tools can be used.
pygettext searches only for _() by default, even though GNU xgettext recognizes the following keywords: gettext, dgettext, dcgettext, and gettext_noop. See the -k/--keyword flag below for how to augment this.
Options
-
-a, --extract-all -
Extract all strings.
-
-d, --default-domain=NAME -
Rename the default output file from messages.pot to name.pot.
-
-E, --escape -
Replace non-ASCII characters with octal escape sequences.
-
-D, --docstrings -
Extract module, class, method, and function docstrings. These do not need to be wrapped in _() markers, and in fact cannot be for Python to consider them docstrings.
-
-h, --help -
Print this help message and exit.
-
-k, --keyword=WORD -
Keywords to look for in addition to the default set, which are: _
-
You can have multiple
-kflags on the command line.
-
-K, --no-default-keywords -
Disable the default set of keywords (see above). Any keywords explicitly added with the
-k/--keywordoption are still recognized.
-
--no-location -
Do not write filename/lineno location comments.
-
-n, --add-location -
Write filename/lineno location comments indicating where each extracted string is found in the source. These lines appear before each msgid. The style of comments is controlled by the
-S/--styleoption. This is the default.
-
-o, --output=FILENAME -
Rename the default output file from messages.pot to FILENAME. If FILENAME is `-' then the output is sent to standard out.
-
-p, --output-dir=DIR -
Output files will be placed in directory DIR.
-
-S, --style=STYLENAME -
Specify which style to use for location comments. Two styles are supported:
- •
-
Solaris # File: filename, line: line-number
- •
-
GNU #: filename:line
-
The style name is case insensitive. GNU style is the default.
-
-v, --verbose -
Print the names of the files being processed.
-
-V, --version -
Print the version of pygettext and exit.
-
-w, --width=COLUMNS -
Set width of output to columns.
-
-x, --exclude-file=FILENAME -
Specify a file that contains a list of strings that are not be extracted from the input files. Each string to be excluded must appear on a line by itself in the file.
If `INPUTFILE' is -, standard input is read.
Releases
2 releases since Debian 3.0 (Woody); the text changed 1 time.
--add-location since Debian 3.1 (Sarge);
--default-domain since Debian 3.1 (Sarge);
--docstrings since Debian 3.1 (Sarge);
--escape since Debian 3.1 (Sarge);
--exclude-file since Debian 3.1 (Sarge);
--extract-all since Debian 3.1 (Sarge);
--help since Debian 3.1 (Sarge);
--keyword since Debian 3.1 (Sarge);
--no-default-keywords since Debian 3.1 (Sarge);
--no-location since Debian 3.1 (Sarge);
--output since Debian 3.1 (Sarge);
--output-dir since Debian 3.1 (Sarge);
--style since Debian 3.1 (Sarge);
--verbose since Debian 3.1 (Sarge);
--version since Debian 3.1 (Sarge);
--width since Debian 3.1 (Sarge);
-D since Debian 3.1 (Sarge);
-E since Debian 3.1 (Sarge);
-K since Debian 3.1 (Sarge);
-S since Debian 3.1 (Sarge);
-V since Debian 3.1 (Sarge);
-a since Debian 3.1 (Sarge);
-d since Debian 3.1 (Sarge);
-h since Debian 3.1 (Sarge);
-k since Debian 3.1 (Sarge);
-n since Debian 3.1 (Sarge);
-o since Debian 3.1 (Sarge);
-p since Debian 3.1 (Sarge);
-v since Debian 3.1 (Sarge);
-w since Debian 3.1 (Sarge);
-x since Debian 3.1 (Sarge).