← 返回命令列表

Linux command

pygettext 命令

网络

复制后可按需替换文件名、目录或参数。

常用示例

Extract translatable strings

pygettext [script.py]

Specify output file

pygettext -o [messages.pot] [script.py]

Extract from directory

pygettext -d [domain] [src/]

Include docstrings

pygettext -D [script.py]

说明

pygettext extracts translatable strings from Python source code. It searches for strings marked with _(), gettext(), and similar functions, creating a POT template file. Part of Python standard library.

参数

-o, --output _file_
Output file name.
-d, --domain _name_
Text domain name.
-p, --output-dir _dir_
Output directory.
-D, --docstrings
Extract docstrings.
-k _keyword_
Additional keyword to look for.
-n, --add-location
Include file:line comments.

FAQ

What is the pygettext command used for?

pygettext extracts translatable strings from Python source code. It searches for strings marked with _(), gettext(), and similar functions, creating a POT template file. Part of Python standard library.

How do I run a basic pygettext example?

Run `pygettext [script.py]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does -o, --output _file_ do in pygettext?

Output file name.