Python Django ugettext_lazy与串联字符串

Python Django ugettext_lazy与串联字符串,python,django,string,concatenation,Python,Django,String,Concatenation,在发布此问题之前,我已搜索了答案。 有一组长字符串按以下方式拆分,需要翻译 string = "This is a very long " \ "string to be translated" 标记后 string = _("This is a very long " \ "string to be translated") 生成的.po文件只保留字符串的第一部分 msgid "This is a very long " msgstr "" 那么,

在发布此问题之前,我已搜索了答案。 有一组长字符串按以下方式拆分,需要翻译

string = "This is a very long " \
          "string to be translated"
标记后

string = _("This is a very long " \
          "string to be translated")
生成的.po文件只保留字符串的第一部分

msgid "This is a very long "
msgstr ""
那么,有没有什么方法可以让它工作,最好不要把代码搞得一团糟

谢谢您

根据文档,在创建邮件时,请使用该选项

我的模型
/manage.py makemessages--locale=de--no wrap

没有
--没有包装
,它看起来是这样的:

#: test/models.py:16
msgid ""
"This is a super long description that should never really exist but it does. "
"Should not wrap."
msgstr ""
#: test/models.py:16
msgid "This is a super long description that should never really exist but it does. Should not wrap."
msgstr ""
添加
--no wrap
后,它看起来如下所示:

#: test/models.py:16
msgid ""
"This is a super long description that should never really exist but it does. "
"Should not wrap."
msgstr ""
#: test/models.py:16
msgid "This is a super long description that should never really exist but it does. Should not wrap."
msgstr ""

我尝试了三重引号,这是有效的,但问题是字符串不能包含\r\n字符(使用三重引号添加)…实际上,我的问题是,我甚至没有使第一个案例起作用。只提取第一行。