Internationalization¶
All package templates use {% translate %} / {% blocktranslate %}, and the
package ships a message catalog with a fully-translated Spanish (es) locale
(compiled .mo, included in the wheel via MANIFEST.in).
Enable¶
Django auto-discovers the app's locale/ directory, so the translations apply
with no extra configuration. With LocaleMiddleware installed, the language
follows the request (Accept-Language, session, cookie) — combine with RTL via
ADMINLTE["layout_rtl"] for right-to-left languages.
Language switcher¶
Let visitors switch languages from the topbar:
# settings.py
LANGUAGES = [("en", "English"), ("es", "Español")]
ADMINLTE = {"language_switcher": True, ...}
# urls.py
path("i18n/", include("django.conf.urls.i18n")),
The dropdown posts to Django's built-in set_language view and redirects back
to the current page.
Add a locale¶
From the package directory:
django-admin makemessages -l fr # extract strings → locale/fr/LC_MESSAGES/django.po
# …translate the .po…
django-admin compilemessages -l fr # compile → django.mo
The same applies to your own project's strings.