Patch for primary menu translation with Nice menus

We encourage users to post events happening in the community to the community events group on https://www.drupal.org.
mvc's picture

I'm working on a contract for D6 rewrite of NDP.ca, which presents content in English and French. Since menu translation isn't completed in D6, and because the available workarounds were judged too awkward for our workflow, my co-worker Greg Cameron has written a small but useful patch to i18nmenu, nice_menus, and menu.inc which allows us to have one primary menu with one set of links (set to "all languages") with menu titles and paths (including url aliases) translated.

This is of course not a replacement for the planned D7 translated menus. The first problem with this is that the list of parent menu link ids in menu_links is only generated for the default language, meaning that the menu functions don't accurately record the active-trail of menu items in other languages, and thus can't determine when to expand a submenu which isn't always expanded by default. This can be seen when generating the menu with i18nmenu_translated_tree('primary-links') but for the purposes of nice_menus is not a problem.

I'm sharing this patch in the hopes that it's useful but be aware this is a quick hack and will likely require some further effort to make work on your site. Any other modules which affect the menu system will probably need to be modified just as we modified nice_menus. If you don't understand what this does you should perhaps consider one of the other approaches to translated menus which are explained clearly in this fine tutorial.

That said, to use this patch, create a set of pages in the default language, add these to your menu(s), and create translations of each page into your other language(s). No promises, but it works for us, using language switching based solely on domain name.

AttachmentSize
i18n_menu.patch.txt1.78 KB

Comments

Thanks

mgifford's picture

I haven't checked this out yet, but plan to. Thanks for putting up the patch.

Mike

OpenConcept | WLP | prax.ca

Internationalization

Group organizers

Group categories

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds: