#5972: Use filters with {% trans %} tag
----------------------------------------------------+-----------------------
Reporter:  Dmitri Fedortchenko <[EMAIL PROTECTED]>  |       Owner:  nobody      
        
  Status:  new                                      |   Component:  
Internationalization
 Version:  SVN                                      |    Keywords:  i18n 
template       
   Stage:  Unreviewed                               |   Has_patch:  1           
        
----------------------------------------------------+-----------------------
 I want to apply filters to my translations in the templates. So.....
 I have created a patch which allows use of the following syntax:

 {{{
 {% trans "username"|capfirst|slice:"2:" noop %}
 {% trans  somevar|slice:"2:" %}
 }}}

 The filters are applied on the result of the translation, and not the
 translation id string.

 While this is already possible by using the '''{{ _("username")|filter
 }}'''
 syntax, I think that '''{% trans %}''' is more "django-ish" and looks
 nicer
 too...

 An important note:
 This patch depends on ticket [http://code.djangoproject.com/ticket/5971
 5971].
 I have a patch that is free from that dependency, however since I got a
 positive response on said ticket I am posting the dependent patch. It's a
 bit smaller and fancier :)

 See:
 [http://groups.google.com/group/django-
 developers/browse_thread/thread/ab366a554b57beba thread1]
 [http://groups.google.com/group/django-
 developers/browse_thread/thread/c90b6e29d20724ca thread2]

-- 
Ticket URL: <http://code.djangoproject.com/ticket/5972>
Django Code <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
-~----------~----~----~----~------~----~------~--~---

Reply via email to