#10436: Application names i18n in the admin app broken
-------------------------------------------+--------------------------------
          Reporter:  ramiro                |         Owner:  ramiro             
                                  
            Status:  new                   |     Milestone:                     
                                  
         Component:  django.contrib.admin  |       Version:  SVN                
                                  
        Resolution:                        |      Keywords:  blocktrans trans 
app_label breadcrumbs capfirst title
             Stage:  Accepted              |     Has_patch:  0                  
                                  
        Needs_docs:  0                     |   Needs_tests:  0                  
                                  
Needs_better_patch:  0                     |  
-------------------------------------------+--------------------------------
Old description:

> Having
>
> {{{
> {% blocktrans with app.name as name %}{{ name }}{% endblocktrans %}
> }}}
>
> as we currently do in some admin templates shows a decision has been made
> to provide developers the means to translate application names. The
> problem is this feature was DOA (r3270,
> `django/contrib/admin/templates/admin/index.html`, similar template code
> was copied since then to another file: r8474, `app_index.html`)
>
> See relevant [http://groups.google.com/group/django-
> users/browse_frm/thread/f8fcbe25e3327c5d django-users] and
> [http://groups.google.com/group/Django-
> I18N/browse_frm/thread/bdcdaf433bfcd144 django-i18n] threads for the
> details.
>
> The attached patch implements the manual steps outlined by the user
> ''patrikk'' in the first thread with the following enhancements:
>
>  * `index`, `app_index`: Moved the markup-as-translatable of app names
> from the template to the view code so the translators don't need to
> translate a second title()'d version of every app name.
>  * Consistent use of the capfirst filter over the app names in the
> breadcrumbs of the different views
>  * Don't touch `base_site.html` in order to provide for translatability
> of the app name in the <title> HTML tag for the application-specific
> model list view, implement the needed change in the relevant view
> (`app_index`) instead (replacing a "%s administration" msgid with a more
> translator-friendly "%(app_label)s administration" one in the process).
> This spare translators the need to translate both a "flatpages" and a
> "flatpages administration" literal.
>  * Extended fixes to other templates that also need them
> (`delete_confirm.html`,  `object_history.html`)
>
> '''Note 1:''' The `change_form.html` template ran the app label (in
> addition to the `capfirst` filter) through the `escape` filter. This has
> been dropped because it seems inconsistent with what is done in rest of
> the templates, and because the app name isn't user-provided content.
>
> '''Note 2:''' There seems to be some inconsistency on how the app name is
> .title()'d for the name that appear in the caption of model tables
> (`index` and `app_index` views`) and `|capfirst`'d for use in HTML title
> and breadcrumbs. This has been left untouched to avoid introducing a
> backward incompatible change.
>
> Note that several of the problems exposed above had already been reported
> in #9273 and that some of the presentation-related (like calling .title()
> and/or capfirst() in view code could be moved to templates if/when #5972
> gets committed (will try to work on adding test+docs to it.)

New description:

 Having

 {{{
 {% blocktrans with app.name as name %}{{ name }}{% endblocktrans %}
 }}}

 as we currently do in some admin templates shows a decision has been made
 to provide developers the means to translate application names.

 Problem is this feature was DOA (r3270,
 `django/contrib/admin/templates/admin/index.html`, similar template code
 was copied since then to another file: r8474, `app_index.html`)

 See relevant [http://groups.google.com/group/django-
 users/browse_frm/thread/f8fcbe25e3327c5d django-users] and
 [http://groups.google.com/group/Django-
 I18N/browse_frm/thread/bdcdaf433bfcd144 django-i18n] threads for the
 details.

 The attached patch implements as a fix the awkward manual steps needed to
 workaround this bug outlined by the user ''patrikk'' in the first thread
 with the following enhancements:

  * `index`, `app_index`: Moved the markup-as-translatable of app names
 from the template to the view code so the translators don't need to
 translate a second title()'d version of every app name.
  * Consistent use of the capfirst filter over the app names in the
 breadcrumbs of the different views.
  * Don't touch `base_site.html` in order to provide for translatability of
 the app name in the <title> HTML tag for the application-specific model
 list view. Implement the needed change in the relevant view (`app_index`)
 instead (replacing a "%s administration" msgid with a more translator-
 friendly "%(app_label)s administration" one in the process). This will
 spare translators having to translate both "<appaname>" and a "<appaname
 administration" literals.
  * Extend above fixes to other templates that also need them
 (`delete_confirm.html`,  `object_history.html`)

 '''Note 1:''' The `change_form.html` template ran the app label (in
 addition to the `capfirst` filter) through the `escape` filter. This has
 been dropped because it seems inconsistent with what is done in rest of
 the templates, and because the app name isn't user-provided content.

 '''Note 2:''' There seems to be some inconsistency on how the app name is
 a) .title()'d for the name that appear in the caption of model tables
 (`index` and `app_index` views`) and b) |capfirst'd for use in HTML title
 and breadcrumbs. This has been left untouched to avoid introducing a
 backward incompatible change.

 '''Note 3:''' A further enhancement would be to move presentation-related
 munging (like calling .title() and/or capfirst() in view code) from views
 to templates if/when #5972 gets committed (will try to work on adding
 test+docs to it) but meanwhile this fix can solve this bug now with what
 we have at hand.

 Several of the problems exposed above had already been reported in #9273.

Comment (by ramiro):

 (made description more clear)

-- 
Ticket URL: <http://code.djangoproject.com/ticket/10436#comment:4>
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 django-updates@googlegroups.com
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to