Menu items disappear when you change language

Last modified: November 17, 2009 - 22:50

Please be aware that the information on this page is probably out-of-date and no longer reflects a usable workaround to this common problem. This page also needs updating(deletion?) as it conflicts with http://drupal.org/node/313302

Summary: When no translation exists for a page, menu items disappear, or they may be displayed in the wrong language

Quick answer: Always set new content to Language Neutral until you are ready to create a translated version. Read more details below.

Environment: You have the i18n module installed. You made multilingual menus by creating some menu items in all of your site's languages. So a menu contains menu items in several languages, but Drupal displays only the menu items that match the current interface language. (note: this is the 2nd option described on this page)

This problem occurs when you are using these multilingual system settings: Path prefix with language fallback, and Current language and language neutral. It may appear with other settings also, but I haven't checked this.

Problem: No translation exists for a page (node). You try to view that page (for example, by opening the original/source/default language version and then clicking another language in the language switcher block)

Effects seen: Menus inside blocks do not display properly (some menu items are missing). Drupal wants to display the translated versions of these menu items, but they do not exist, so it displays nothing. (Note: 'translated version' means a translated string created on the 'Translate interface' page)

If they are not displayed in blocks, Drupal's built-in menus (Primary menu and secondary menu) still show all menu items. But if no translation exists for a string then the menu items are displayed in the wrong language, even if you have created an appropriate language version of that menu item).

In addition, if you click on another menu item from this malformed page, the same interface problems will appear on the new page. This happens even when an appropriate translation exists for the new page, so it would normally be displayed without problems.

Solution: This problem appears when you have created a node (e.g. a page, story or blog post) but you have not created a translated version of it and you have set the node to any particular language. To prevent this issue: when you create new content nodes, always set untranslated pages to Language Neutral (Normally, the Language setting appears above the body text area where you are typing in the new content). Do not change the node's language setting until you are ready to add a translated version of the node.

In theory, another workaround for this issue might be to use 'Translate interface' to create translations of all menu items. However, even if this works, it is probably a bad idea as it means you will have two copies of every menu item's name, so you need to manually keep these synchronized in future.

 
 

Drupal is a registered trademark of Dries Buytaert.