Skip to content

Django: Change or translate the app name in the admin menu

Let's say I have a Django app "users". The admin menu shows this as category "Users". That's ok, but if the website users speak another language I want this name translated. Also I'm not necessarily using "Users" as name in the admin menu as section name, but can use something more descriptive. "Website Users", as example.

 

Rename the section

Renaming the section name in the admin menu is easy to do. Open the "apps.py" file and add one line to the "Meta" class:

verbose_name = "Website Users"

The whole file should look similar to:

from django.apps import AppConfig

class UsersConfig(AppConfig):
    name = 'users'
    verbose_name = 'Website Users'

Translate the name

Using a translated name is a bit more work, because the entire Django translation framework must be in place. That's necessary to do anyway if you want to provide translations in your website, and is not part of this blog posting.

Once the framework is activated, all what's necessary is importing the translation module, use a translated string, and provide a translation:

from django.apps import AppConfig
from django.utils.translation import gettext_lazy as _

class UsersConfig(AppConfig):
    name = 'users'
    verbose_name = _('Website Users')

After updating the translations with "makemessages" and compiling the translations with "compilemessages" the admin website will start using your translation as section name.

  • Twitter
  • Bookmark Django: Change or translate the app name in the admin menu at del.icio.us
  • Facebook
  • Google Bookmarks
  • FriendFeed
  • Digg Django: Change or translate the app name in the admin menu
  • Bloglines Django: Change or translate the app name in the admin menu
  • Technorati Django: Change or translate the app name in the admin menu
  • Fark this: Django: Change or translate the app name in the admin menu
  • Bookmark Django: Change or translate the app name in the admin menu at YahooMyWeb
  • Bookmark Django: Change or translate the app name in the admin menu at Furl.net
  • Bookmark Django: Change or translate the app name in the admin menu at reddit.com
  • Bookmark Django: Change or translate the app name in the admin menu at blinklist.com
  • Bookmark Django: Change or translate the app name in the admin menu at Spurl.net
  • Bookmark Django: Change or translate the app name in the admin menu at Simpy.com
  • Bookmark Django: Change or translate the app name in the admin menu at blogmarks
  • Bookmark Django: Change or translate the app name in the admin menu with wists
  • wong it!
  • Bookmark using any bookmark manager!
  • Stumble It!
  • Identi.ca

Trackbacks

No Trackbacks

Comments

Display comments as Linear | Threaded

No comments

Add Comment

Enclosing asterisks marks text as bold (*word*), underscore are made via _word_.
E-Mail addresses will not be displayed and will only be used for E-Mail notifications.
To leave a comment you must approve it via e-mail, which will be sent to your address after submission.
Form options