Django tip: Translating your application names (app_label)
This MUST be a common issue for international developers: We use some geeky English name for our application and afterwards find that the translated admin index looks a little silly in the eyes of our native speaking users. Apparently a patch has been accepted in the Django dev version, but it’s not yet in the trunk. Here’s what to do: In your applications’ __init__.py files put:
1 2 | from django.utils.translation import gettext_noop gettext_noop("AppName") |
When your run manage.py makemessages -a there will be entries for these. Make sure to remove lines saying #, fuzzy. Now all you have to do is to customize the default admin template called index.html so it will actually do the translation of the application names.
18 | <caption>{% trans app.name %}</caption> |
September 13th, 2008 at 12:31 pm
Thanks. I’d be glad to know how this applies to django-1.0, since now there is no make-messages.py to patch.
And non-english users would welcome application names to be translated. Until now I haven’t found an easy way to do it.
November 21st, 2008 at 2:58 am
Sorry about the late reply. The patch has been approved, so now you just have to do the replacement in your admin template… that is: Replace the ‘blocktrans’ with a simple ‘trans’ and run ./manage.py makemessages -l (you language code) -a and you should see your application translations in the .po files given that you’ve also applied the dummy translation in __init__.py
Hope this helps.