#14181: Template tag needed to disable/force L10N formatting on a per-variable
basis
----------------------------------+-----------------------------------------
Reporter: russellm | Owner: nobody
Status: new | Milestone:
Component: Internationalization | Version: 1.2
Keywords: | Stage: Unreviewed
Has_patch: 0 |
----------------------------------+-----------------------------------------
The L10N support added in Django 1.2 is great, but there are times when
you don't want to use L10N, regardless of any system settings.
#14164 is one manifestation of this problem. Outside of sitemaps, any data
being rendered to XML (or any other format for data interchange) is
generally going to need data to be rendered in "english" locale format.
A simple workaround is to render the value to a string in the context, so
that the template renders a string, not an integer/float. However, a more
general appoach is required.
Some possible options: A template filter to disable localization:
{{{
{{ value|unlocalized }}
}}}
A template filter to force a specific localization:
{{{
{{ value|locale:"en" }}
}}}
Or, template tag variants of the same:
{{{
{% unlocalized %}
{{ value }}
{% endunlocalized %}
{% localize "en" %}
{{ value }}
{% endlocalize %}
}}}
The "localize" filter is the easiest to implement, but probably not the
easiest to use.
--
Ticket URL: <http://code.djangoproject.com/ticket/14181>
Django <http://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/django-updates?hl=en.