Opened 6 years ago

Closed 6 years ago

#26403 closed Cleanup/optimization (fixed)

"Invalid block tag" message is English except for one word

Reported by: Meiyer Owned by: amureki
Component: Template system Version: 1.8
Severity: Normal Keywords:
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: yes UI/UX: yes

Description (last modified by Meiyer)

The invalid_block_tag() function of template Parser makes use of the django.utils.text.get_text_list() function to generate the list of expected block tags. The only caveat is that get_text_list() takes a concatenation parameter whose default value is the translated string or, while the rest of the error message is untranslated. This results in crazy messages such as

Invalid block tag: 'qq', expected 'xx','yy' 或 'zz'

(for 1.8 and earlier)

Invalid block tag on line 234: 'qq', expected 'xx','yy' 或 'zz'. Did you forget to register or load this tag?

(for 1.9 and later).

Looks like the solution should be easy: pass the 'or' concatenator to get_text_list() instead of relying on the default value.

Change History (12)

comment:1 Changed 6 years ago by Meiyer

Description: modified (diff)

comment:2 Changed 6 years ago by Tim Graham

Easy pickings: set
Summary: Crazy translation in template processing error"Invalid block tag" message is English except for one word
Triage Stage: UnreviewedAccepted
Version: 1.8

comment:3 Changed 6 years ago by Anderson Resende

Owner: changed from nobody to Anderson Resende
Status: newassigned

comment:4 Changed 6 years ago by amureki

Has patch: set
Owner: changed from Anderson Resende to amureki

comment:5 Changed 6 years ago by amureki

Triage Stage: AcceptedReady for checkin

comment:6 Changed 6 years ago by Susan Tan

What is the github pull request link?

comment:7 Changed 6 years ago by Marc Tamlyn

Needs tests: set

comment:8 in reply to:  6 Changed 6 years ago by amureki

Replying to susan:

What is the github pull request link?

It is displayed in top menu on "Pull requests" part.

Here is fast link: https://github.com/django/django/pull/6386

P.S. I'll update it with tests as needed.

comment:9 Changed 6 years ago by Tim Graham

Triage Stage: Ready for checkinAccepted

comment:10 Changed 6 years ago by amureki

Triage Stage: AcceptedReady for checkin

comment:11 Changed 6 years ago by Claude Paroz

Needs tests: unset
Triage Stage: Ready for checkinAccepted

The Ready for checkin flag is not supposed to be set by the patch author, but by a reviewer.

comment:12 Changed 6 years ago by Tim Graham <timograham@…>

Resolution: fixed
Status: assignedclosed

In f8bbba80:

Fixed #26403 -- Removed translated content in "Invalid block tag" message.

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