Opened 14 years ago

Closed 13 years ago

Last modified 13 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: no UI/UX: no

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

Change History (7)

comment:1 by Russell Keith-Magee, 14 years ago

Resolution: invalid
Status: newclosed

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 by anonymous, 13 years ago

Resolution: invalid
Status: closedreopened

comment:3 by anonymous, 13 years ago

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 by anonymous, 13 years ago

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 by anonymous, 13 years ago

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 by Ramiro Morales, 13 years ago

Resolution: invalid
Status: reopenedclosed

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 by Weslie Ni <nispray@…>, 13 years ago

Cc: nispray@… added
Severity: Normal
Type: Uncategorized

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

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