1

当我尝试ugettext_lazy与reportlab的Table类一起使用时,在没有翻译时不显示默认文本,而是显示输出django.utils.functional.__proxy__ object at 0xb54921ec例如,

import ugettext_lazy as _

heading = (_('Service'), _('Price'), _('Note'))
table = Table([heading])

并且输出如上所述。有没有人遇到过这种情况?

4

1 回答 1

1

代码可能依赖于作为实际字符串的对象而不是惰性对象。尝试使用常规的 ugettext。在这种情况下,字符串将在传递到 reportlab 之前进行翻译

from django.utils.translation import ugettext as _

heading = (_('Service'), _('Price'), _('Note'))
table = Table([heading])
于 2013-03-01T10:53:58.640 回答