|
List Info
Thread: i18n model field not translated
|
|
| i18n model field not translated |
  United States |
2007-11-05 22:15:22 |
Hi, I am working on a multilingual project, mainly in
indonesia and
english.
i tried to do i18n on my model fields but i cant get it work
on the
admin site.
the model name is translated, however the fields name is
not.
here's my model.py
class Company(models.Model):
name = models.CharField(_('name'),
help_text=_('This is the
help text'), max_length = 255)
logo = models.ImageField(_('logo'), upload_to =
'logo/%Y%m%d
%H%M%S')
detail = models.TextField(_('detail'), blank =
True)
letterhead = models.ImageField(_('letterhead'),
upload_to = 'logo/
%Y%m%d%H%M%S', blank = True)
class Admin:
pass
fields = (
(None,{
'fields': ('name','logo','detail')
}),
('Optional', {
'classes' : 'collapse',
'fields' : ('letterhead',)
}),
)
class Meta:
verbose_name = _('Company')
verbose_name_plural = _('Companies')
def __unicode__(self):
return '%s' % self.name
as you can see the field 'name', the help_text is
translated, but the
'name' itself is not translated.
did i do something wrong?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "Django users" group.
To post to this group, send email to django-users googlegroups.com
To unsubscribe from this group, send email to
django-users-unsubscribe googlegroups.com
For more options, visit this group at htt
p://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---
|
|
| Re: i18n model field not translated |
  United States |
2007-11-05 22:27:51 |
Hi otonk
Use ugettex_lazy form models
from django.utils.translation import ugettext_lazy as _
cschand
On Nov 6, 9:15 am, otonk <sampah2ot... gmail.com> wrote:
> Hi, I am working on a multilingual project, mainly in
indonesia and
> english.
> i tried to do i18n on my model fields but i cant get it
work on the
> admin site.
> the model name is translated, however the fields name
is not.
>
> here's my model.py
>
> class Company(models.Model):
> name = models.CharField(_('name'),
help_text=_('This is the
> help text'), max_length = 255)
> logo = models.ImageField(_('logo'),
upload_to = 'logo/%Y%m%d
> %H%M%S')
> detail = models.TextField(_('detail'), blank =
True)
> letterhead = models.ImageField(_('letterhead'),
upload_to = 'logo/
> %Y%m%d%H%M%S', blank = True)
>
> class Admin:
> pass
> fields = (
> (None,{
> 'fields': ('name','logo','detail')
> }),
> ('Optional', {
> 'classes' : 'collapse',
> 'fields' : ('letterhead',)
> }),
> )
>
> class Meta:
> verbose_name = _('Company')
> verbose_name_plural = _('Companies')
>
> def __unicode__(self):
> return '%s' % self.name
>
> as you can see the field 'name', the help_text is
translated, but the
> 'name' itself is not translated.
> did i do something wrong?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "Django users" group.
To post to this group, send email to django-users googlegroups.com
To unsubscribe from this group, send email to
django-users-unsubscribe googlegroups.com
For more options, visit this group at htt
p://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---
|
|
| Re: i18n model field not translated |
  United States |
2007-11-05 22:51:54 |
I did..
from django.db import models
from django.utils.translation import ugettext_lazy as _
--- code emmited ---
name = models.CharField(_('name'), help_text=_('This
is the
help text'), max_length = 255)
--- code emmited ---
on the above code, the
[ help_text=_('This is the help text') ]
is translated.. however the _('name') is not
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "Django users" group.
To post to this group, send email to django-users googlegroups.com
To unsubscribe from this group, send email to
django-users-unsubscribe googlegroups.com
For more options, visit this group at htt
p://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---
|
|
| Re: i18n model field not translated |
  United States |
2007-11-05 23:36:21 |
Try this
name = models.CharField(verbose_name=_('name'),
help_text=_('This is the
help text'), max_length = 255)
On Nov 6, 9:51 am, otonk <sampah2ot... gmail.com> wrote:
> I did..
>
> from django.db import models
> from django.utils.translation import ugettext_lazy as
_
> --- code emmited ---
>
> name = models.CharField(_('name'),
help_text=_('This is the
> help text'), max_length = 255)
>
> --- code emmited ---
>
> on the above code, the
> [ help_text=_('This is the help text') ]
> is translated.. however the _('name') is not
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "Django users" group.
To post to this group, send email to django-users googlegroups.com
To unsubscribe from this group, send email to
django-users-unsubscribe googlegroups.com
For more options, visit this group at htt
p://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---
|
|
| Re: i18n model field not translated |
  United States |
2007-11-05 23:55:28 |
its not working...
isnt verbose_name is for meta class?..
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "Django users" group.
To post to this group, send email to django-users googlegroups.com
To unsubscribe from this group, send email to
django-users-unsubscribe googlegroups.com
For more options, visit this group at htt
p://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---
|
|
| Re: i18n model field not translated |
  United States |
2007-11-06 02:01:09 |
problem solved..
it lies on the django.po
i havent remove the
#, fuzzy
mark.. thats why its not translated
link: http://groups.google.com/group/
django-users/browse_thread/thread/e8476fa11cefc2b7
Notice that the message in question is marked as
"fuzzy". That means
the
translation does not quite match the source string. I cannot
read
Chinese well enough to know if the string is at all close,
but one
obvious difference is that the source string contains a
"%d" format
marker whilst the translation contains a "%s"
marker.
By default, fuzzy translations are not included in the
output. A
translator has to check each one, verify it is correct (or
correct it)
and remove the fuzzy comment. Then the result will be
include in the
MO
file.
You may wish to update the file and submit a diff of the
changes to
Trac
so that it can be committed.
Thanks for the group..
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "Django users" group.
To post to this group, send email to django-users googlegroups.com
To unsubscribe from this group, send email to
django-users-unsubscribe googlegroups.com
For more options, visit this group at htt
p://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---
|
|
[1-6]
|
|