I have created a page with RoutablePageMixin and defined a child path. I want to translate this child path based on the active language with gettext_lazy like it works in Django within urlpatterns. I always get 404. Is this even possible or am I missing something?
Here is my Page definition:
class StudyBrowserPage(RoutablePageMixin, TranslatedPage):
page_description = "Weiterleitung zum Studienbrowser"
@path('')
def list_studies(self, request):
studies = Study.objects.all()
return self.render(request, context_overrides={
'studies': studies
})
# here I actually want another parameter, but i tried to keep it simple. So don't mind the uselessness of the function.
@path(_('studie') + '/')
def study_detail_view(self, request):
return self.render(request, template='wagtail_home/study_detail.html')
I have translated the string in my django.po:
msgid "studie"
msgstr "study"
Calling .../studie/
works. .../study/
does not.
Edit:
I think I have all the necessary settings in my config:
“context_processors”:
‘django.template.context_processors.i18n’,
USE_I18N = True
WAGTAIL_I18N_ENABLED = True
I also have wagtail-localize installed.
user27369772 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.