Menus and primary / secondary links

Last modified: February 5, 2009 - 08:34

With Drupal 6 core alone, user defined menu items are not translatable. The i18nmenu (Menu translation) module (part of the i18n package) provides the following features:

  • Allows setting a language when creating a custom menu item so that the menu item will only show up for that language.
  • Localizes other custom menu items without language. It does this by adding a "Limit search to: Menu" option on the Search tab of the Translate interface at Administer > Site building > Translate interface.

A menu item linked to a node, due to how the menu system works and the 'Language selection' feature in i18n, will be displayed only when the node language matches the page language.
The Menu translation module relies on theming and blocks for displaying the right links for each case. Thus for uses different than displaying the menu in a block, it may not always work.

About primary/secondary links

This is a special case, as they're basically menus that can be displayed as a block but not always. Most of the themes display them directly instead of using a block so for this case the i18n's multilingual menu items features won't work.

The alternate and recommended approach for having different primary/secondary links for each language is:

  1. Enable language dependent variables. The one needed for this is 'menu_primary_links_source' for primary links, and 'menu_secondary_links_source' for secondary links.
  2. Create as many menus as languages in Administer > Site building > Menus > Setting. Set up the links for each language.
  3. Set up the menu to be used for each language in Administer > Site building > Menus > Settings. You will need to switch languages while on this page.

also see

abaddonsun - November 5, 2008 - 13:28

also see http://groups.drupal.org/node/13092#comment-56417 for a theme hack approach..

Semi-automated menu translation

blundeln - November 11, 2008 - 11:09

I'm currently building a D6 site that will render in seven different languages, so maintaining separate menu items (or menus) for different languages will not be realistic. So I plan to implement the following functionality, but would like to know if anyone has already done this or what things I should watch out for:

When any menu is loaded from the Drupal API (i.e. before it is passed to the rendering functions), I plan to intercept and update the menu items as follows:

  • If the menu item points to a node and the node has a translation for the current language, set the menu item's display text to the translated node title and href to the translated node address
  • else (e.g. if this is a link to a system page), render the menu item's display text through t(), so the user can add interface translation strings. This is very intuitive with the module http://drupal.org/project/l10n_client

Of course, I will be using some caching techniques to improve performance.

I've had a play with this idea, and so far this is the most realistic and intuitive solution for my site. Does anyone have any feedback on this or links to similar functionality?

Thank you in advance for any advice

Nick

I agree with you - is it

bloggybusiness - December 11, 2008 - 11:43

I agree with you - is it working fine?
Where can we find this approach? Did you published some code/patch/module?

primary links

josys64 - November 21, 2008 - 03:41

Hi,

i certainly missing something, i'm trying to translate the menu in 2 languages (english/french), i followed the indication but i have 2 differents menus one in english and one in french.
Is it possible to have one menu for the both languages ?

Same issue

bloggybusiness - December 11, 2008 - 11:43

Same issue

Workaround?

dckantor - December 23, 2008 - 15:21

I would like to use a single menu for all my links (3 languages) and have the parent menu items in a horizontal block at the top (usual location for primary links) but their children show up in the left sidebar. Does anyone know if this is possible?

Currently I have one menu with items in 3 langs. This menu is set as the source for primary and secondary. It works fine if I want to have both 1˚ and 2˚ links inline at the top of the page but some of my secondary links have children themselves and these are lost with this setup.

See "Translation Table" module

AltoRetrato - February 7, 2009 - 23:05

I'm using Drupal version 6, and it makes translating your site to be more complicated than it should. I found that the Translation Table module can help you with that, so if anyone is interested, you should take a look.

You can also simply use the

couzinhub - June 4, 2009 - 22:56

You can also simply use the 'translate interface' built in drupal. It's very efficient

 
 

Drupal is a registered trademark of Dries Buytaert.