Opened 13 years ago

Closed 13 years ago

Last modified 12 years ago

#15632 closed (fixed)

django-admin.py makemessages failure on ' symbol in templates comment block

Reported by: andrew@… Owned by: nobody
Component: Internationalization Version: dev
Severity: Keywords: xgettext
Cc: steve@… Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

django-admin.py makemessages fails on mezzanine.core application default admin/base_site.html template (attachment:base_site.html)

$ django-admin.py makemessages -l ru
processing language ru
Error: errors happened while running xgettext on base_site.html
./templates/admin/base_site.html.py:15: warning: unterminated string
./templates/admin/base_site.html.py:16: warning: unterminated string
./templates/admin/base_site.html.py:21: warning: unterminated string

It caused by xgettext when it see "Mezzanine's" string in this lines. In django v1.2 error doesn't appears.

Attachments (4)

base_site.html (8.1 KB ) - added by andrew@… 13 years ago.
15632-1.diff (2.6 KB ) - added by Claude Paroz 13 years ago.
Handle properly multiline translator comments
15632-2.diff (2.7 KB ) - added by Claude Paroz 13 years ago.
Same patch which doesn't replace newlines (following ramiro's idea)
15632-5.diff (5.1 KB ) - added by Ramiro Morales 13 years ago.
New patch for the issue -- preseves line numbers in .po file comments, expanded tests

Download all attachments as: .zip

Change History (13)

by andrew@…, 13 years ago

Attachment: base_site.html added

comment:1 by Jannis Leidel, 13 years ago

Which version of gettext do you use? Running xgettext --version should give you that info.

comment:2 by andrew@…, 13 years ago

xgettext (GNU gettext-tools) 0.18.1

comment:3 by Jannis Leidel, 13 years ago

Hm, this is probably related to #14045 and #15495. Can you check with gettext 0.17?

comment:4 by andrew@…, 13 years ago

Keywords: xgettext added

Same situation with gettext 0.17.

[grad@grad-book core]$ LANG=C xgettext --version
xgettext (GNU gettext-tools) 0.17
...

[grad@grad-book core]$ LANG=C PYTHONPATH=/home/grad/repos/django /home/grad/repos/django/django/bin/django-admin.py --version
1.3 rc 1 SVN-15876
[grad@grad-book core]$ LANG=C PYTHONPATH=/home/grad/repos/django /home/grad/repos/django/django/bin/django-admin.py makemessages -l ru
processing language ru
Error: errors happened while running xgettext on base_site.html
./templates/admin/base_site.html.py:15: warning: unterminated string
./templates/admin/base_site.html.py:16: warning: unterminated string
./templates/admin/base_site.html.py:21: warning: unterminated string

[grad@grad-book core]$ LANG=C django-admin.py --version
1.2.5
[grad@grad-book core]$ LANG=C django-admin.py makemessages -l ru
processing language ru
[grad@grad-book core]$ echo $?
0

comment:5 by andrew@…, 13 years ago

Is there any way to see content of ./templates/admin/base_site.html.py file? Does django any change in template before passing it to xgettext?

by Claude Paroz, 13 years ago

Attachment: 15632-1.diff added

Handle properly multiline translator comments

by Claude Paroz, 13 years ago

Attachment: 15632-2.diff added

Same patch which doesn't replace newlines (following ramiro's idea)

comment:6 by Claude Paroz, 13 years ago

Has patch: set
Triage Stage: UnreviewedAccepted

by Ramiro Morales, 13 years ago

Attachment: 15632-5.diff added

New patch for the issue -- preseves line numbers in .po file comments, expanded tests

comment:7 by Ramiro Morales, 13 years ago

15632-5.diff is a further evolution of the patch we were discussing with Claude on IRC. I wasn't comfortable with ignoring the multi-line comments in templates because that means we get non-accurate line numbers #: path/to/template/file.html:NN comments in the PO files, so this patch also solves this. Tests were also expanded to cover some edge cases.

comment:8 by Ramiro Morales, 13 years ago

Resolution: fixed
Status: newclosed

In [15882]:

Fixed #15632 -- Ignore unrelated content in template multi-line comment blocks when looking for tokens that identify comments for translators. Thanks andrew AT ie-grad DOT ru for the report and Claude Paroz for spotting the problem and helping to fix it.

comment:9 by Jacob, 12 years ago

milestone: 1.3

Milestone 1.3 deleted

Note: See TracTickets for help on using tickets.
Back to Top