django-distill icon indicating copy to clipboard operation
django-distill copied to clipboard

Generate pages for all languages

Open GergelyKalmar opened this issue 2 years ago • 1 comments

Currently django-distill only generates the pages for the language that is set in settings.LANGUAGE_CODE. It would be great if django-distill could generate pages for URLs that are in i18n_patterns for each language in settings.LANGUAGES.

That is, having this settings file:

LANGUAGES = [
    ('en-us', 'English (United States)'),
    ('en-gb', 'English (United Kingdom)'),
]
LANGUAGE_CODE = 'en-us'

and this urls.py file:

from django.conf.urls.i18n import i18n_patterns
from django.utils.translation import gettext_lazy as _
from django_distill import distill_path

urlpatterns = [
    *i18n_patterns(distill_path(route=_('localization/'), view=..., name='localization')),
]

We should get the following files:

output/en-us/localization/index.html
output/en-gb/localisation/index.html

Note that the appropriate links already work with runserver, we would only need to identify internationalized pages and generate them somehow.

GergelyKalmar avatar Jun 01 '23 10:06 GergelyKalmar