Opened 4 years ago

Closed 4 years ago

#16075 closed Bug (fixed)

Django 1.3 new "localize" tag/filter doesn't work?

Reported by: sci.feng@… Owned by: Horst Gutmann <zerok@…>
Component: Documentation Version: 1.3
Severity: Normal Keywords: dceu2011
Cc: Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description (last modified by jezdez)

I've noticed that Django 1.3 introduced the new "localize" tag/filter.
http://docs.djangoproject.com/en/1.3/topics/i18n/localization/

It says:

    To activate or deactivate localization for a template block, use:

    {% localize on %}
        {{ value }}
    {% endlocalize %}

    {% localize off %}
        {{ value }}
    {% endlocalize %}

However I always got the error message:

Invalid block tag: 'localize'

Looks like the "localize" filter doesn't work as well. Can anybody help me? Or can anybody else confirm if this is a bug? Thanks!

Attachments (1)

ticket-16075.diff (875 bytes) - added by Horst Gutmann <zerok@…> 4 years ago.

Download all attachments as: .zip

Change History (7)

comment:1 Changed 4 years ago by jezdez

  • Component changed from Template system to Documentation
  • Description modified (diff)
  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Triage Stage changed from Unreviewed to Accepted

Simply put, this is a documentation issue. You need to load the template tag library first ({% load l10n %}), as mentioned here: http://docs.djangoproject.com/en/1.3/ref/templates/builtins/#l10n

comment:2 Changed 4 years ago by Horst Gutmann <zerok@…>

  • Owner changed from nobody to Horst Gutmann <zerok@…>
  • UI/UX unset

Changed 4 years ago by Horst Gutmann <zerok@…>

comment:3 Changed 4 years ago by Horst Gutmann <zerok@…>

  • Has patch set

It is also indicated in the "Controlling localization in templates" chapter of the localization documentation. In any case, I've also added the actual template lib loading in all the template snippets in this document.

comment:4 Changed 4 years ago by trez

  • Triage Stage changed from Accepted to Ready for checkin

Doc modification checked

comment:5 Changed 4 years ago by Horst Gutmann <zerok@…>

  • Keywords dceu2011 added

comment:6 Changed 4 years ago by jezdez

  • Resolution set to fixed
  • Status changed from new to closed

In [16371]:

Fixed #16075 -- Corrected localize template tag docs. Thanks, Horst Gutmann.

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