由于%sign,我有以下错误你知道怎么克服这个错误吗?
django-admin.py编译器消息-l tr
正在处理文件django.po in/../locale/tr/LC\u消息
命令错误:执行msgfmt失败:/…/locale/tr/LC_MESSAGES/django。po:139:“msgstr”不是有效的Python格式字符串,与“msgid”不同原因:在指令1中,字符{不是有效的转换说明符。
/…/locale/tr/LC_MESSAGES/django.po:146:“msgstr”不是有效的Python格式字符串,与“msgid”不同原因:在指令1中,字符{不是有效的转换说明符。
msgfmt:发现2个致命错误
模型.py

def get_full_title(self):
    return _(u"{discounted_price} TL for {original_price} TL worth of {product_name} at {place_name} {locality} {city} ({discount_percentage}% off)").format(
        discounted_price=int(self.discounted_price),
        original_price=int(self.original_price),
        product_name=self.product.name,
        place_name=self.product.place.name,
        locality=self.product.place.locality,
        city=self.product.place.get_city_display(),
        discount_percentage=self.get_rounded_discount_percentage(),
    )


def get_short_title(self):
    return _(u"{product_name} at {place_name} ({discount_percentage}% off)").format(
        product_name=self.product.name,
        place_name=self.product.place.name,
        discount_percentage=self.get_rounded_discount_percentage(),
    )

姜戈.po
#: deals/models.py:169
#, python-format, python-brace-format
msgid ""
"{discounted_price} TL for {original_price} TL worth of {product_name} at "
"{place_name} {locality} {city} ({discount_percentage}% off)"
msgstr ""
"{discounted_price} TL for {original_price} TL worth of {product_name} at "
"{place_name} {locality} {city} (%{discount_percentage} indirim)"

#: deals/models.py:181
#, python-format, python-brace-format
msgid "{product_name} at {place_name} ({discount_percentage}% off)"
msgstr "{product_name} at {place_name} (%{discount_percentage} indirim)"

最佳答案

您可以通过将%加倍来逃避%%

09-26 07:06