Opened 17 years ago
Closed 17 years ago
#7083 closed (invalid)
table names are not getting translated in the 'add' and 'change' forms in admin
Reported by: | Owned by: | nobody | |
---|---|---|---|
Component: | Internationalization | Version: | dev |
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
I am using version 7435. Here in admin, the table names get translated correctly in the main index page. However in the 'add' page, the table name does not get translated. Again in the 'change' page it is not getting translated. I get:
in english: 'areas'
in finnish: 'Alueet'
no problem
but in the add screen:
in english: Add area
in finnish: Uusi area (the word 'area' is not being translated)
similarly, in the change list:
the finnish comes as 'Valitse muokattava area' instead of 'Valitse
muokattava alueet'
same problem in the edit screen.
Attachments (4)
Change History (10)
comment:1 by , 17 years ago
Resolution: | → invalid |
---|---|
Status: | new → closed |
comment:2 by , 17 years ago
Resolution: | invalid |
---|---|
Status: | closed → reopened |
Oyvind, it doesn't look invalid to me. Reopening, at least until we can get some more details. I admit the report is hard to decipher.
Kenneth: please be careful when reporting a bug. It's not particularly clear what you are seeing because you say the "change" page is not getting translated, but then says it is showing "Alueet" in Finish (which means it is being translated). You've also run everything together in a single sentence, so it's easy to lose track of what's going on.
From what I can see looking at the code, only change_form.html has a bug (it doesn't translate the model's verbose name). Can you please take some screenshot fragments to show which strings you are talking about on each of the pages. Or at least describe where these strings appear on the page. I might well be misunderstanding the description sentence, but I can't work out all the cases you're talking about (or, at least, I can't see why they wouldn't be translated in the code).
I think we need a bit more information here before we can confirm and/or fix this.
Also, please confirm that the model's verbose_name attribute (not just verbose_name_plural) is marked up with ugettext_lazy()
comment:3 by , 17 years ago
thanks for reopening it - I find that my tamil, kannada and telugu sites are also having the same problem. For the finnish site, lets take the Area model. Model code:
from django.db import models
from fida.thumbnails.field import *
from django.contrib.auth.models import User
from django.utils.translation import ugettext_lazy as _
from datetime import datetime
class Area(models.Model):
code = models.IntegerField(_("Area Code Number"), unique=True)
name = models.CharField(_("Area Name"),max_length=150,unique=True)
description_en = models.TextField(_("Area Description in English"),blank=True,null=True)
description_fi = models.TextField(_("Area Description in Finnish"),blank=True,null=True)
picture = models.ImageField(_("Picture of Area"),upload_to="images/misc",
blank=True,null=True)
iscurrent = models.BooleanField(_("Is active"),default = True)
class Admin:
list_display = ("name","code",)
search_fields = code
js = ("js/tiny_mce/tiny_mce.js","js/tiny_mce/textareas.js")
class Meta:
verbose_name_plural = _("Areas")
def unicode(self):
return u"%s" %(self.name)
I have taken screenshots and will attach
by , 17 years ago
by , 17 years ago
by , 17 years ago
by , 17 years ago
comment:4 by , 17 years ago
(Please hit preview before posting code to check it's formatted properly.)
I asked on the mailing list and in my first comment here about verbose_name being marked for translation and now I see that it is not so marked. So that's a bug in your code right there, since a bunch of those pages use the verbose_name (not verbose_name_plural). After all, you add a singular item, not a plurality of items. And this shows in your examples, since only the words "Areas" is translated.
So, when you fix the verbose_name problem (by marking it for lazy translation), how many of the problems disappear?
comment:5 by , 17 years ago
ok - when I set verbose_name=_("Area") all problems are solved. Thanks Malcolm for your patience and dedication.
comment:6 by , 17 years ago
Resolution: | → invalid |
---|---|
Status: | reopened → closed |
I've confirmed that everything appears to be working properly here when verbose_name
and verbose_name_plural
are marked for translation.
Think this is a .po issue, parts of strings are not translated.