Language cache context should be passed to the block

Created on 1 October 2020, about 4 years ago
Updated 16 May 2024, 7 months ago

Problem/Motivation

On Multilingual sites, at the moment the menu block seems to be cached in the first language you visit.

This is resolved by passing the language:language_content cache context to the menu block.

I'm unsure if this is the best approach, but it fixes the issue and all languages are cached correctly from my testing. I'm attaching a patch that does this.

🐛 Bug report
Status

Postponed

Version

1.0

Component

Code

Created by

🇳🇿New Zealand danielveza Brisbane, AU

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • 🇩🇪Germany Anybody Porta Westfalica

    Whao crazy, it looks like it causes this effect for us: 🐛 URL language detection with empty path prefix not working Needs work

    We're using content language and saw translated custom menu items appearing in the wrong language as anonymous user (only). After clearing cache the correct menu links in the current content language appear!

    That smells like a cache context issue?

  • 🇩🇪Germany Anybody Porta Westfalica

    Regarding the patch implementation: I'm unsure if that's not something that should already be added in the parent level?

    Maybe in SystemMenuBlock? Or is it something that would have to be added by content_translation module?

    Do we know anyone who can tell that easily?

    Also see 🐛 Untranslated menu items are displayed in menus Needs work for some slightly related issues...

  • 🇩🇪Germany Anybody Porta Westfalica

    I guess this will help with debugging: [#3162480]

  • Status changed to Postponed 7 months ago
  • 🇩🇪Germany Grevil

    Update concerning @Anybody's comments here. The issue was solely fixed through using the patch in 🐛 URL language detection with empty path prefix not working Needs work .

    The patch provided here, seems to not be needed anymore. I could imagine, that the "languages:language_content" cache context is already added through some event handler anyway, but please test it for yourself first!

    Setting this postponed for now, until others confirm our observations.

Production build 0.71.5 2024