I want to translate a django form. How do I translate the labels of the fields?
I tried field.label=ugettext_lazy(field.label)
, but the labels are not getting populated in django.po file
I may have gotten the concept of ugettext_lazy wrong, I think
In simple terms I want the field labels to be put into django.po file.
The other translations done using ugettext
and {% trans %}
tag are working well
I have been able to translate the fields based on a model by setting verbose_name
but when I try that for a form field I get a TypeError
class ExampleForm(forms.Form):
f1 = forms.CharField(label= ugettext_lazy('field label'))