What does '_' do in Django code?

前端 未结 3 782
北海茫月
北海茫月 2021-02-20 13:41

Why does this Django code use _ in front of \'has favicon\'

has_favicon = models.BooleanField(_(\'has favicon\'))
3条回答
  •  面向向阳花
    2021-02-20 14:11

    _ 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.

提交回复
热议问题