Menus

Managing translated menus - part 2

In the previous post I talked about managing translated menus in Drupal.

The new menu-sync functionality we've added to ICanLocalize translator helps run multilingual menus without having to spend time managing translation.

It detects any changes you make in the menu in the original language and automatically applies them to all translations.

The clip below shows it in action below. You can see how I'm editing the English menu and the German menu follows.

In the video I show:

  • The original English and German menu structure
  • I modify the English menu structure
  • Save the English menu
  • Show how the German menu is synchronized with changes to the English menu

Managing translated menus

I've been investigating ways for organising translated menus in Druapl. In the past I used to create one big menu that contains both the original menu items and the translated menu items. This works reasonably well for smaller menu structures but when the menu size and the number of languages grows it can quickly become unwieldy.

Consider a site that has 100 menu items organized in a menu hierarchy 3 or 4 levels deep. Then add 5 languages and you now have a menu of 600 menu items!

An alternative is to have a menu for each language and use an i18n variable to choose which menu to display according to the language. To do this:

1) Set the i18n_variables in the settings.php file (idea came from Drupal's Multilingual Variables page):

$conf['i18n_variables'] = array(
  // Primary and secondary links
  'menu_primary_links_source',
  'menu_secondary_links_source',
);

2) Create a menu for each language, Administer > Site building > Menus > Add Menu and give them a meaningful title and name like "Main Navigation", "Main Navigation (Spanish)", etc. Then when creating translated content use the corresponding root menu.

3) Go to the menu settings page Administer > Site building > Menus > Setting for each language and set the source for primary and secondary menus for each language.

Syndicate content