Opened 14 years ago
Closed 14 years ago
#10891 closed (fixed)
Blocktrans fails in trunk if there are newlines in the text and eol is dos
Reported by: | Stavros Korokithakis | Owned by: | Marc Garcia |
---|---|---|---|
Component: | Internationalization | Version: | dev |
Severity: | Keywords: | i18n-fixed | |
Cc: | Triage Stage: | Fixed on a branch | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description (last modified by )
The blocktrans tag silently fails to show the translation if there are newlines in the text to be translated. Only the original text is shown.
{% blocktrans %} A test. {% endblocktrans %}
fails.
{% blocktrans %}A test.{% endblocktrans %}
succeeds.
Attachments (1)
Change History (10)
comment:1 Changed 14 years ago by
Description: | modified (diff) |
---|
comment:2 Changed 14 years ago by
Component: | Uncategorized → Internationalization |
---|
Something related to this was reported six month ago on django-users: http://groups.google.com/group/django-users/browse_frm/thread/c051bc5d63e14f0/9956309f9177c972?hl=en&lnk=gst#9956309f9177c972
These are my notes (from a draft of a message never sent to that thread):
I've just tested this and found Django is behaving correctly (translated content is rendered when the template is used with a proper i18n/language preference setup/translation).
Multi-line literals inside blocktrans tags
are represented in the PO file as multi-line strings that end with the '\n' literal, e.g.:
msgid "" "First line\n" "Second line\n" "Third line, variable content: %(line3text)s\n" "Fourth line\n" :
it doesn't matter if the original template file containing such string has Unix or DOS line-endings (both styles were tested).
Also tested was converting the PO file to DOS line endings (starting from r8576 we are creating such files with Unix line-endings
irrespective of the platform where the makemessages
command is run) before running compilemessages
with similar succesful results.
Platforms where tests were performed are Linux and Windows.
Could you please attach a simple example that demonstrates this?.
comment:3 Changed 14 years ago by
Owner: | changed from nobody to Marc Garcia |
---|
comment:4 Changed 14 years ago by
Summary: | Blocktrans fails in 1.1b if there are newlines in the text → Blocktrans fails in trunk if there are newlines in the text and eol is dos |
---|---|
Triage Stage: | Unreviewed → Accepted |
Version: | 1.1-beta-1 → SVN |
I could get this error, but just happens when template's eol is dos. \n is correctly added to .po file, but then, it looks like when looking for the translation, string doesn't match, probably it's missing to replace dos eol by unix one.
comment:5 Changed 14 years ago by
Has patch: | set |
---|---|
Needs tests: | set |
Patch needs improvement: | set |
I added a patch that proof that the error is when comparing the string to translate, with the one in the catalog. They don't match, because of using different eol.
I don't think that patch is the best way to fix this error, I just added it to show what's failing.
comment:6 Changed 14 years ago by
comment:7 Changed 14 years ago by
Triage Stage: | Accepted → Fixed on a branch |
---|
comment:8 Changed 14 years ago by
Keywords: | i18n-fixed added |
---|---|
Needs tests: | unset |
Patch needs improvement: | unset |
comment:9 Changed 14 years ago by
Resolution: | → fixed |
---|---|
Status: | new → closed |
(In [11964]) Fixed #7980 - Improved i18n framework to support locale aware formatting (dates and numbers) and form processing.
Thanks to Marc Garcia for working on this during his Google Summer of Code 2009!
Additionally fixes #1061, #2203, #3940, #5526, #6449, #6231, #6693, #6783, #9366 and #10891.
Please use preview.