[Fixed]-Django crispy-forms: No i18n?

1👍

Try using ugettext_lazy.

c.f. This great answer on “When should I use ugettext_lazy?”

In definitions like forms or models you should use ugettext_lazy because the code of this definitions is only executed once (mostly on django’s startup); ugettext_lazy translates the strings in a lazy fashion, which means, eg. every time you access the name of an attribute on a model the string will be newly translated-which makes totally sense because you might be looking at this model in different languages since django was started!

c.f. also The crispy_forms test suite

Leave a comment