Menu Translation Hierarchy does not yet apply to:

* Primary or secondary links 'hardcoded' into templates (which is the case for core Drupal themes) rather than using menu blocks
* Partially-translated menus (e.g. only some of the links in a menu have been translated - then the rest just don't show)

The attached patch resolves this. It needs tests, although an adaptation of the code is working for at least two real-world clients at the time of writing.

For the second point, that's because the module is only really applying to a menu as a whole. To be fair, that may be desired behaviour, and I'm not sure whether it's possible with this patch to intentionally partially-translate a menu (perhaps a menu item would have to be translated but set to hidden in the sublanguage?).

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

james.williams created an issue. See original summary.

james.williams’s picture

Issue tags: +Needs tests, +ComputerMinds
james.williams’s picture

Status: Active » Needs work
james.williams’s picture

Title: Menu Translation Hierarchy only applies to whole menus in menu blocks » Menu Translation Hierarchy does not apply to all menus
dipakmdhrm’s picture

While I can confirm that the patch in #1 actually works, I also noticed that the alter hook implemented by this patch is not very efficient and consumes a lot of resources.
On a large site, this can have adverse effects.

james.williams’s picture

Do you mean any particular part of the alter hook? I presume you mean i18n_menu_hierarchy_translated_menu_link_alter - there are 3 alter hooks implemented by this patch!
Using hook_translated_menu_link_alter at all is generally not very efficient, but translatable sites often have to use it anyway - and this patch merely implements it, rather than triggering menu links to actually allow its use at all.