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.

Note: This has to be done for each language. eg.

admin/build/menu/settings for default language

Setting English menu

es/admin/build/menu/settings for Spanish

Setting Spanish menu

Automatically managing menu translation

We're currently implementing this in the ICanLocalize Translator module so that this (and more) is all done automatically. When you translate a site using ICanLocalize Translator, all contents will be translated by professional (human) translators, and the module builds all the translations in Drupal.

To use this, users need to enable synchronization between the original and translated menus. Then, ICanLocalize Translator will re-arranging the translated menus when the original menu structure is edited.

 

Comentarios

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.

More information about formatting options