My site's menu is created by selecting the root page's children:
@register.simple_tag(takes_context=True)
def get_menuitems(context):
site_root = Site.find_for_request(context["request"]).root_page
menuitems = site_root.get_children().live().in_menu()
return menuitems
But as the site is available in multiple languages, I need to find the localized sibling of the (English) root page to get a localized menu. How can I do that?
Solution was much simpler than expected:
@register.simple_tag(takes_context=True)
def get_menuitems(context):
site_root = Site.find_for_request(context["request"]).root_page.localized
menuitems = site_root.get_children().live().in_menu()
return menuitems