Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
当我尝试ugettext_lazy与reportlab的Table类一起使用时,在没有翻译时不显示默认文本,而是显示输出django.utils.functional.__proxy__ object at 0xb54921ec例如,
ugettext_lazy
django.utils.functional.__proxy__ object at 0xb54921ec
import ugettext_lazy as _ heading = (_('Service'), _('Price'), _('Note')) table = Table([heading])
并且输出如上所述。有没有人遇到过这种情况?
代码可能依赖于作为实际字符串的对象而不是惰性对象。尝试使用常规的 ugettext。在这种情况下,字符串将在传递到 reportlab 之前进行翻译
from django.utils.translation import ugettext as _ heading = (_('Service'), _('Price'), _('Note')) table = Table([heading])