About String Translations
In Django projects, gettext_lazy()
marks a string as "to be translated" whereas gettext()
translates it immediately.
- Use
gettext_lazy()
in app configurations, models, forms, middlewares, and backends. - Use
gettext()
in views, context processors, and template tags/filters.
Tips and Tricks Programming Django 4.2 Django 3.2 Django 2.2
Also by me
Django Paddle Subscriptions app
For Django-based SaaS projects.
Django GDPR Cookie Consent app
For Django websites that use cookies.