Drupal 7: How to add translated nodes to the menu system

1.7k views Asked by At

Using the Locale and Internationalization (i18n) modules I've setup a multilingual site and added some content nodes, with translations, to the main menu.

The menu items for the translated nodes disappear when changing the site's language. I understand that this is because when creating a translation, it's necessary to add the node to the menu structure again. Is this correct?

I have four languages, and maybe 300 pages in the main menu. So, after adding the translated pages there will be 1200 menu items in the main menu. This is going to be very fiddly to manage.

Is there a better way of doing this where you only have to add the node to the menu once?

1

There are 1 answers

0
Hervé Donner On

it's necessary to add the node to the menu structure again. Is this correct?

Yes

First you can read the "Menu translation" section here : http://evolvingweb.ca/story/drupal-7-multilingual-whats-new-i18n

I mainly use "translate and localize" option. In this case I have only one menu for all languages.

Translate and localize

I first create the "language neutral" menu items if I have some that share the same path and position in the menu tree accross all languages on my site (like views or special menu items for example). I can then translate (only) the label of these menu items in the "translate" tab in the edit form.

For the rest I go to each node edit form and use the "Provide menu link" option in the "Menu settings" tab. This has the advantage to set the correct language automatically.

Remember to put the correct language prefix to see your menu for a given language.

e.g. for the main menu :

  • Default site language : /admin/structure/menu/manage/main-menu
  • FR: /fr/admin/structure/menu/manage/main-menu
  • ES: /es/admin/structure/menu/manage/main-menu

Fixed language

You can also use one menu/language. You need to set the "Fixed language" option in this case.

For the main menu enable the "Source for the Main links" multilangual variable here : admin/config/regional/i18n/variable Then set correct options at admin/structure/menu/settings

For other menus or menu blocks use either the "languages" tab in block configuration or context module if you have it already on your site.