idlesign / django-etc

Tiny stuff for Django that won't fit into separate apps.
https://github.com/idlesign/django-etc
BSD 3-Clause "New" or "Revised" License
39 stars 1 forks source link

Get translated verbose_name #1

Closed mayait closed 7 years ago

mayait commented 7 years ago

All the items in my model are being translated by django.utils.translation For example

code = models.CharField(max_length=200, null=True, blank=True,  unique=True, 
help_text=_('Product catalog code unique identifier'),
verbose_name=_('Product Code'))

Is there any way to get the verbose_name string translated?

idlesign commented 7 years ago

That should work with django.utils.translation.gettext_lazy. If it doesn't, please describe when do you use activate language function.

mayait commented 7 years ago

It was my bad, is working with gettext_lazy on the model side imported as:

from django.utils.translation import ugettext_lazy as _

It's Amazing!