0

We have a multilingual site where the menu links are based on the current locale. If 100 nodes are created in English and 50 nodes are created in Italian, for example, then when the locale is set to English, then the English menu link should display, but if the locale is set to Italian then i should only see the 50 nodes set to Italian.

The locale/language detection is based on URL so if the URL has ".com/en/" then the locale should be English, but if the URL is ".com/it/" then the locale should be Italian. As a result, the menu will display based on that locale.

The issue we are having is that on the Italian pages under menu settings, when i view the Parent Item Dropdown, i am seeing all the English menu links (whose language=en) displays with "(disabled)" next to it. All Italian links display as normal without "(disabled)".

Menu Setting -- Parent Item

Current example with language in parenthesis:

  • Parent Link (en)
  • Child Link1 (en)
  • Child Link2 (en)
  • Child Link3 (disabled) <-----this is an it (Italian)
  • Child Link4 (disabled) <-----this is an it (Italian)

The ideal scenario would be when i click on "Parent Item" dropdown that i only see links based on the current node's language (not other links assigned to a language that is different than the current node's language).

Expected behavior (if node's language = it):

  • Parent Link (IT)
  • Child Link3
  • Child LInk4

Expected behavior (if node's language = en):

  • Parent Link (en)
  • Child Link1
  • Child LInk2
0

I am not sure about settings, but I can suggest you way to do it programmatically.

You can use TEMPLATE_preprocess_menu_tree (replace TEMPLATE with your theme name) in your template.php of theme folder. Inside the function you can loop through the tree & validate it's translation with current site language & reset or set access deny if it doesn't match.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.