Opened 17 years ago

Closed 17 years ago

#3970 closed (invalid)

Adding {{{as}}} keyword to {{{trans}}}

Reported by: axiak@… Owned by: hugo
Component: Internationalization Version: dev
Severity: Keywords: i18n trans context tags
Cc: Triage Stage: Unreviewed
Has patch: yes Needs documentation: no
Needs tests: yes Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

Currently the {% trans ... %} tag allows for translating text to be rendered to the template. However, there are cases where allowing this to be written to the context for further processing is useful. An easy example was when a friend in IRC wanted to have multiple cases for the same phrase on the same page. He did not want to clutter his .po files with alternate case styles. He just wanted to use the provided filters on the translated text (for one case). The as keyword would be used like so:

{% trans "this is a test" as translated_text %}
{{ translated_text|upper }}

{{ translated_text|lower }}

Note that the noop keyword should still work:

{% trans "this is a test" as translated_text noop %}
{{ translated_text|upper }}

{{ translated_text|lower }}

I have written patches. Please let me know what you think!

Attachments (2)

118n-tags_3970.patch (3.2 KB ) - added by axiak@… 17 years ago.
Alteration to templatetags/i18n.py for as keyword
i18n-docs_3970.patch (869 bytes ) - added by axiak@… 17 years ago.
Corresponding documentation

Download all attachments as: .zip

Change History (4)

by axiak@…, 17 years ago

Attachment: 118n-tags_3970.patch added

Alteration to templatetags/i18n.py for as keyword

by axiak@…, 17 years ago

Attachment: i18n-docs_3970.patch added

Corresponding documentation

comment:1 by anonymous, 17 years ago

Needs tests: set

comment:2 by axiak@…, 17 years ago

Resolution: invalid
Status: newclosed
{% blocktrans with "value"|upper as translated_title %}
Note: See TracTickets for help on using tickets.
Back to Top