Why does this Django code use _
in front of 'has favicon'
has_favicon = models.BooleanField(_('has favicon'))
Why does this Django code use _
in front of 'has favicon'
has_favicon = models.BooleanField(_('has favicon'))
If you look in the import statements, you'll find that they tied _ to a function that turns stuff into unicode and localizes it by writing:
from django.utils.translation import ugettext_lazy as _
_
is usually a macro/function from gettext, it means the argument is a localized string. this is not limited to Django or Python. in fact gettext is originally a package for C programs, ported to many other languages over the years.