Sphinx 是否支持构建 po 文件的无包装选项?

Does Sphinx support a no wrap option for building the po files?

我正在尝试在 sphinx 中使用创建 po 文件 sphinx-intl update -p build/locale/ -l de.

然而,它产生的输出看起来像

#: ../../source/my-documentation.rst:16
msgid ""
"Far quitting dwelling graceful the likewise received building. "
"Unaffected remarkably get yet introduced excellence terminated led."
"But truth being state can she china widow."
msgstr ""

而我想要的是:

#: ../../source/my-documentation.rst:16
msgid ""
"Far quitting dwelling graceful the likewise received building. Unaffected remarkably get yet introduced excellence terminated led. But truth being state can she china widow."
msgstr ""

有什么方法可以指定不换行选项吗? 任何帮助将不胜感激。谢谢!

根据sphinx-intl的源码,无法配置

可以看到heresphinx-intl 调用 pofile 函数而不带 wrapwidth 参数。然而,polib 库支持你所需要的,所以你可以 fork sphinx-intl,或者猴子修补它,然后调用 pofile 函数,例如wrapwidth=150

目前,po 文件中有一个参数可以设置行的长度:--line-width

例如:

sphinx-intl update -p build/gettext -l es -l ja --line-width=120

您可以将此参数设置为很长的数字。

这已于 2019 年通过增强 #28 实现到 Sphinx。