Code

Opened 7 years ago

Closed 7 years ago

#3970 closed (invalid)

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

Reported by: axiak@… Owned by: hugo
Component: Internationalization Version: master
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: UI/UX:

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@… 7 years ago.
Alteration to templatetags/i18n.py for as keyword
i18n-docs_3970.patch (869 bytes) - added by axiak@… 7 years ago.
Corresponding documentation

Download all attachments as: .zip

Change History (4)

Changed 7 years ago by axiak@…

Alteration to templatetags/i18n.py for as keyword

Changed 7 years ago by axiak@…

Corresponding documentation

comment:1 Changed 7 years ago by anonymous

  • Needs documentation unset
  • Needs tests set
  • Patch needs improvement unset

comment:2 Changed 7 years ago by axiak@…

  • Resolution set to invalid
  • Status changed from new to closed
{% blocktrans with "value"|upper as translated_title %}

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.