Code

Opened 4 years ago

Closed 3 years ago

Last modified 3 years ago

#13719 closed Uncategorized (invalid)

blocktrans in Django 1.2 doesn't work any more

Reported by: schmid.ul@… Owned by: nobody
Component: Internationalization Version: 1.2
Severity: Normal Keywords: blocktrans
Cc: nispray@… Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

Hello,

the "blocktrans" in the template system in DjangoProject worked fine in Django 1.1 but doesn't work in verion 1.2 or 1.2.1 any more. I've debug it and found out, that it finally ends in the inner except block in the method 'def get_response(self, request)' in the file 'django/core/handlers/base.py', it's round the 101st line in the file. If I print the exception it just says 'incomplete format' without any other information. What do you think is the mistake here?

Sincerly,
Ulrich Schmid

Attachments (0)

Change History (7)

comment:1 Changed 4 years ago by russellm

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Resolution set to invalid
  • Status changed from new to closed

If you're uncertain if you've found a problem and you're looking for debugging advice, you should be asking a question on django-users. Trac is for identifying clearly identified bugs -- which means that we require clear test case that reproduces the problem.

Django has an extensive test suite, which includes many tests of blocktrans. So, it does "work" under at least *some* conditions. It's entirely probably that you have found a problem, but you haven't provided any way for us to verify your claim. This means you need to provide sample code or template that exhibits the problem, along with any extra setup details necessary to reproduce the problem.

Closing invalid; if you care to provide the additional detail, please reopen.

comment:2 Changed 3 years ago by anonymous

  • Resolution invalid deleted
  • Status changed from closed to reopened

comment:3 Changed 3 years ago by anonymous

view function is:
return render_to_response('language.html', {'request': request}, context_instance=RequestContext(request))

The content of template list here:
{% load i18n %}

{% get_current_language as LANGUAGE_CODE %}
{% get_available_languages as LANGUAGES %}
{% get_current_language_bidi as LANGUAGE_BIDI %}

<form action="/i18n/setlang/" method="post">

{% csrf_token %}
<input name="next" type="hidden" value="{{request.path}}" />
<select name="language">

{% for lang in LANGUAGES %}
<option value="{{ lang.0 }}" {%ifequal lang.0 request.LANGUAGE_CODE%}selected="selected"{%endifequal%}>{{ lang.1 }}</option>
{% endfor %}

</select>
<input type="submit" value="Go" />

</form>

{% trans "This is the title." %}
{% blocktrans with request.POST as r %}
This string will have {{r}} value inside.
{% endblocktrans %}

comment:4 Changed 3 years ago by anonymous

This line work:

{% trans "This is the title." %}

But this does not:

{% blocktrans with request.POST as r %} This string will have {{r}} value inside. {% endblocktrans %} 

comment:5 Changed 3 years ago by anonymous

Actually blocktrans doesn't work too, like this code:

{% load i18n %}

{% get_current_language as LANGUAGE_CODE %}
{% get_available_languages as LANGUAGES %}
{% get_current_language_bidi as LANGUAGE_BIDI %}

<form action="/i18n/setlang/" method="post">
  {% csrf_token %}
  <input name="next" type="hidden" value="{{request.path}}" />
  <select name="language">
    {% for lang in LANGUAGES %}
    <option value="{{ lang.0 }}" {%ifequal lang.0 request.LANGUAGE_CODE%}selected="selected"{%endifequal%}>{{ lang.1 }}</option>
    {% endfor %}
  </select>
  <input type="submit" value="Go" />
</form>


{% trans "This is the title." %}
{% blocktrans %}
This string will have value inside.
{% endblocktrans %}

comment:6 Changed 3 years ago by ramiro

  • Resolution set to invalid
  • Status changed from reopened to closed

I've just tested this (with code in the 1.2.X maintenance branch) just in case and it is working for me.

Please post you case to the django-users mailing list or to the #django IRC channel, and be sure to include a full description of what doesn't wok and details about you setup e.g. if you are using the LocaleMiddleware, if you have created translations to your language of the literal contained inside trans and blocktrans template tags, etc.

Please don't reopen this ticket until you've made use of the user support channel options listed above and are sure this isn't an usage error but a Django bug.

comment:7 Changed 3 years ago by Weslie Ni <nispray@…>

  • Cc nispray@… added
  • Severity set to Normal
  • Type set to Uncategorized

Hi, seems the same problem comes to me.
Is this ticket solved or just usage error?

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.