Enable Internationalization (i18n) for static generation
masterTo generate a multi-language static site, configure your settings.py and use i18n_patterns in your urls.py.
- In
settings.py: SetUSE_I18N = Trueand defineDISTILL_LANGUAGES(or use the standardLANGUAGESsetting). - In
urls.py: Wrap yourdistill_pathdefinitions withi18n_patterns.
django-distill will then generate URLs with the appropriate language prefixes (e.g., /en/some-file.html, /fr/some-file.html).
# settings.py
USE_I18N = True
DISTILL_LANGUAGES = ['en', 'fr', 'de']
# urls.py
from django.conf.urls.i18n import i18n_patterns
from django_distill import distill_path
urlpatterns = i18n_patterns(
distill_path('some-file.html',
SomeView.as_view(),
name='i18n-view',
distill_func=some_func)
)