In admin's index.html template we have "<h2>{{ app.name }}</h2>".
I'm replacing it with "<h2>{% blocktrans with app.name as n %}{{ n }}{%
endblocktrans %}</h2>"
For some reason, I still see the original app name in the admin
interface.
For debugging, I inserted below <h2>...</h2> the following:
{% trans 'Flatpages' %}
{% blocktrans %}Flatpages{% endblocktrans %}
and they both show my translation.
As a side note, I'd appreciate if a convention for providing verbose
names for apps was defined (maybe in the app's __init.py__?), and if
the admin interface used translations for those verbose names when
available.
Huh? That would produce a message ID like this:
"%(n)s"
And so won't translate anything but just put the value of app.name in
there.
bye, Georg
(Sorry, I must have hugely misunderstood something here.)
Yes, that can work. Only problem: you need to have the applcation name
marked up with one of the gettext or trans things in your code, or
make-messages.py will just throw that line out of your .po file on the
next run. A simple way to do that is to just add some gettext calls
with the right strings to a module in your code - that way
make-messages.py will see those calls and throw the strings into the
.po file. Application names aren't taken from some constant string but
from python module names, so that's why you need to provide your own
translation hooks to be able to translate them.
bye, Georg
It would be kind of neat to either have the app module __name__
registered automatically for translation, or to be able to provide a
verbose_name (and verbose_name_plural) for the application and have the
admin app use that instead of the module __name__.