Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 837833
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T05:12:24+00:00 2026-05-15T05:12:24+00:00

Django’s internationalization is very nice (gettext based, LocaleMiddleware), but what is the proper way

  • 0

Django’s internationalization is very nice (gettext based, LocaleMiddleware), but what is the proper way to translate the model name and the attributes for admin pages? I did not find anything about this in the documentation:

  • http://docs.djangoproject.com/en/dev/topics/i18n/internationalization/
  • http://www.djangobook.com/en/2.0/chapter19/

I would like to have "Выберите заказ для изменения" instead of "Выберите order для изменения". Note, the ‘order’ is not translated.

First, I defined a model, activated USE_I18N = True in settings.py, run django-admin makemessages -l ru. No entries are created by default for model names and attributes.

Grepping in the Django source code I found:

$ ack "Select %s to change"
contrib/admin/views/main.py
70:        self.title = (self.is_popup and ugettext('Select %s') % force_unicode(self.opts.verbose_name) or ugettext('Select %s to change') % force_unicode(self.opts.verbose_name))

So the verbose_name meta property seems to play some role here. Tried to use it:

class Order(models.Model):
    subject = models.CharField(max_length=150)
    description = models.TextField()
    class Meta:
        verbose_name = _('order')

Now the updated po file contains msgid 'order' that can be translated. So I put the translation in. Unfortunately running the admin pages show the same mix of "Выберите order для изменения".

I’m currently using Django 1.1.1.
Could somebody point me to the relevant documentation? Because google can not. 😉 In the mean time I’ll dig deeper into the django source code…

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T05:12:24+00:00Added an answer on May 15, 2026 at 5:12 am

    Important things not mentioned in the Django documentation:

    • run django-admin compilemessages, e.g. as a part of your build
      process. Thanks stevejalim!
    • apply django’s ugettext_lazy() to model names ( Meta class and verbose_name )
    • attribute (model field verbose_name) names can also be translated with ugettext_lazy()
    • use lazy translation in your model metadata, otherwise the translation
      happens while loading the model classes and the settings of your users,
      especially the browser settings, will not be taken into account
    • I use some scoping for attribute names, e.g. separating the model name
      and attribute names with a pipe. The same convention is used in
      ruby-gettext. Background: attribute names like ‘title’ or ‘name’ translated
      differently in the most languages depending on context. Example
      ‘Book|title’ -> ‘Titel’ or ‘Buchtitel’ in German. But
      ‘Chapter|title’ would be translated as ‘Überschrift’.

    Example using above principles:

    from django.utils.translation import ugettext_lazy as _
    class Order(models.Model):
        subject = models.CharField(max_length=150, verbose_name = _('Order|subject'))
        description = models.TextField(            verbose_name = _('Order|description'))
        class Meta:
            verbose_name = _('order')
            verbose_name_plural = _('orders')
    

    Or is there a better way to translate the model and admin pages?

    Either way we should enhance the Django documentation and fill the gap!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Django is making very nice forms after creating a models.py and an admin.py. How
django.forms is very nice, and does almost exactly what I want to do on
Django's get_or_create function always cause get() returned more than one Model name error in
Django's admin is very nice and many of the widgets is reuseable. What are
Django query gives me below output format,but i want below format data=`[{'total': 1744, 'name:
In django, can I have 2 controller actions with the same name, but one
(Django 1.x, Python 2.6.x) I have models to the tune of: class Animal(models.Model): pass
Django objects aren't subscriptable meaning if you have user.name you can't define it with
Django 1.1.1 Models.py: class Datapoint(models.Model): parameter1 = models.FloatField() parameter2 = models.FloatField() I want to
Django Newbie question. I have the following model: class Leg(models.Model): drive_date = models.DateField() startpoint

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.