Problem:
I created some menu item with different language, and they link to the same node corresponding language.
Then I access the node, other menus (link same node, different language) also active.

Reproduce step:
- Create two menu item with different language.
- EN Example (link. /demo) (not have JP translation)
- JP Example (link. /jp/demo) (not have EN translation)

EN Example
JP Example

- Access /jp/demo path.

JP Frontend

Solution:

I think we should filter menu link content by current language. I created a patch for this issue.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Kang Miao created an issue. See original summary.

Berdir’s picture

Status: Active » Needs work

Patch doesn't apply anymore.

ravi.shankar’s picture

Status: Needs work » Needs review
FileSize
3.65 KB

Here is a re-roll of above patch.

Berdir’s picture

I don't think this behavior is consistent with core, which is why I'm unsure about adding this. Drupal core shows unrelated menu links for other languages, it just treats it as missing translation and falls back.

Oscaner’s picture

Based on this issue Performance issues when having high amount of menu items.

I did some work for menu trail by path, to support multi-language menus.

Oscaner’s picture

Version: 8.x-1.1 » 8.x-1.3
FileSize
4.98 KB

Based on #2910494 latest patch.

Oscaner’s picture

FileSize
5 KB
776 bytes

Based on #2910494 latest patch.

Berdir’s picture

Version: 8.x-1.3 » 2.x-dev
Status: Needs review » Needs work

Needs work after that other issue has been committed.

Suresh Prabhu Parkala’s picture

FileSize
4.24 KB

Re-rolled the patch against the latest 2.x.

Berdir’s picture

I'm assuming that this is used in combination with core patches to respect the menu link translation status because as mentioned before, core doesn't do that right now and I'm hesitant to include this before a core patch is committed.

Even then, this might not always be the expected behavior when translations are missing, should probably still return *something*

The patch also needs some coding standard improvements (indendation seems off) and $menu as a variable name is confusing, should probably be $menu_link_content.

burnellw_cit’s picture

FileSize
5.18 KB