简体   繁体   中英

Django: trans and blocktrans not escaping modulo (%)

I'm trying to makemessages on a template that has a translation which contains a modulo, like this;

{% trans "100% escaping problems sucks" %}

But I get this error:

Error: errors happened while running xgettext on site.html
./templates/site.html.py:34: warning: 'msgid' format string with unnamed 
arguments cannot be properly localized:

The translator cannot reorder the arguments.
Please consider using a format string with named arguments,
and a mapping instead of a tuple for the arguments.

And if I try to escape it like this;

{% trans "100%% escaping problems sucks" %}

I get this error;

Error: errors happened while running xgettext on site.html.py
xgettext: error while opening "./templates/site.html.py" for 
reading: No such file or directory

I have no idea why it is looking for ./templates/site.html.py .. it should be ./templates/site.html

Any idea ?

Edit: I forgot the Django version, it's 1.2.0 beta1

根据此票证,您可以尝试升级到至少1.2.1 ...

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM