#15172 closed (worksforme)
Admin do not translate models.
Reported by: | aledr | Owned by: | nobody |
---|---|---|---|
Component: | Internationalization | Version: | 1.2 |
Severity: | Keywords: | ||
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
According to Django's docs the above code should show a translated model name in admin but it stills showing its name only in english.
# -*- coding: utf-8 -*- from django.db import models from django.utils.translation import ugettext_lazy as _ # Create your models here. class Activity(models.Model): """This model describes the customer activities.""" name = models.CharField(_(u'Activity'), max_length=100) description = models.CharField(_(u'Description'), max_length=100) class Meta: verbose_name = _(u'Activity') verbose_name_plural = _(u'Activities') def __unicode__(self): return unicode(self.name)
Attachments (1)
Change History (5)
comment:1 by , 14 years ago
Resolution: | → worksforme |
---|---|
Status: | new → closed |
by , 14 years ago
comment:2 by , 14 years ago
Resolution: | worksforme |
---|---|
Status: | closed → reopened |
All steps are done according documentation...
Folder 'project/locale/pt_BR/LC_MESSAGES/' contains: django.mo and django.po files.
.po file is attached. As I said, just model names are not translated in Django's admin.
Thanks.
comment:3 by , 14 years ago
Resolution: | → worksforme |
---|---|
Status: | reopened → closed |
I've tried this myself, and it definitely works as advertised.
Please ask on django-users (either the mailing list or IRC channel) to narrow down the source of your problem. I'm going to guess there's something wrong with your configuration, but Trac isn't the place to narrow down the problem.
If the result of that process determines a specific bug in Django, feel free to reopen this ticket with more details. However, as currently presented, the ticket is incorrect. Admin models *are* translated.
The translations don't happen by magic. Using _() just marks a string as available for translation. You then need to use createmessages to generate a local, manually translate all the string, then run makemessages to compile the translations.
If you do all those steps (which are also documented), admin woks as expected.