This project is not covered by Drupal’s security advisory policy.

Allows a single node menu item to point to different node translations belonging to the same translation set depending on the current language.

In conjunction with the Menu translation module, shipped with the Internationalization project, Menu translation (Node) allows to have a fully translated menu without needing to replicate the node menu items per language.

Usage

Enable Menu translation (Node), create a node menu item and check the Enable node translation checkbox on the menu item editing or node form. You can change the default value of the checkbox for a specific menu in the menu edit form.

When node translation is enabled for a translation set, the edit form of the source node will show the usual menu item form. The node translations instead will have a textfield allowing to translate the menu item title through the String translation feature of the Internationalization project.

Note that if you need to translate titles into the default language you need to add the following line to your settings.php:

<?php
$conf["i18nstrings_translate_langcode_$langcode"] = TRUE;
?>

where $langcode is the language code of the default language.

Note also that node translation works only for node types having translation support enabled.

Why can't I get this working?

People using Menu translation (Node) for the first time might experience some problems in making it work properly. The main cause of these problems is the language selection feature of the Internationalization project. Language selection is designed to hide from node listings nodes not matching the configured criteria. Due to how the menu system internals work, language selection is applied also to menu items pointing to nodes, therefore if a site is not set up correctly, its menus might not work as intended.

To work around this problem Menu Translation (Node) provides two ways which share the same basic concept: temporarily disabling language selection while rendering the menu tree.

  • The first method is transparent to the user and concerns primary and secondary links directly output in the page template through the $primary_links and $secondary_links variables. If they are enabled in the theme settings, both variables should contain the correct menu output without incurring in language selection problems.
  • The second method concerns menu blocks and requires the user to replace the usual menu blocks with their [i18n] version, which can be found in the blocks administration page as usual. Note that if primary/secondary links variables are enabled through the theme settings (even if they are not actually output in the page template), the corresponding menu blocks will work without needing to be replaced with their [i18n] version. This is due to the fact that the (correct) menu tree is computed just once and then reused by all the code needing it. For the same reason also the menu blocks provided by Menu Block will work only if they involve primary or secondary links.

If you still cannot get everything working one possible reason is you just found a bug, but please be sure to have explored the other possibilities: the first step to troubleshoot this is disabling language selection by setting it to All values. No language conditions apply. If this does not fix the issue you should disable any module that might impact on the menu tree rendering; this should help you to find out whether any module is conflicting with MTN.

Dependencies

This module depends on the Menu translation module shipped with the Internationalization project. Read #386372: Localize menu items by node translation set to learn more about the design process.

Drupal 7 version

There is some non-officially supported work to port this module to D7, please check the related project for details. People needing to build D7 multilingual sites with a highly replicated structure may want to try the Entity translation module, which allows to create different content translations for the same node.

Credits

The development of this module has been sponsored by psegno.

Project Information

Downloads