#11966 closed (fixed)
Error: errors happened while running xgettext over template file with a literal that contains '%'
Reported by: | Adrian Ribao | Owned by: | nobody |
---|---|---|---|
Component: | Internationalization | Version: | dev |
Severity: | Keywords: | ||
Cc: | Triage Stage: | Accepted | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
I find an error when running
manage.py makemessages -a
The problem comes when it reads a .html file with this content:
{% blocktrans %}This is some text ... 75% ... more text ... 75% of ...{% endblocktrans %}
The error is:
Error: errors happened while running xgettext on info-tripartita.html ./templates/myfile.html.py:98: atención: '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.
It's ok if there is only one % symbol in the string and even if the string has no characters after the second %:
{% blocktrans %}This is some text ... 75% ... more text ... 75%{% endblocktrans %}
I can't find a way to solve this problem.
Attachments (1)
Change History (6)
comment:1 by , 15 years ago
Summary: | Error: errors happened while running xgettext → Error: errors happened while running xgettext over template file with a literal that contains '%' |
---|
comment:2 by , 15 years ago
Triage Stage: | Unreviewed → Accepted |
---|
by , 14 years ago
Attachment: | 11966.patch added |
---|
comment:3 by , 14 years ago
Has patch: | set |
---|
Attached patch (download it if Trac doesn't show it) tries a simple fix in doubling all '%' signs found inside a translatable strings. I'm not completely convinces it's safe to do so, but I think we miss some extensive tests regarding templatize results. A more clever solution would test if there is another "%(var)s" in the string, and if not, simply output a # no-python-format comment so as xgettext uses it.
comment:4 by , 14 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
Fix + tests