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?).
Comment | File | Size | Author |
---|---|---|---|
language_hierarchy-menu-item-fallbacks.patch | 3.68 KB | james.williams | |
Comments
Comment #2
james.williams CreditAttribution: james.williams commentedComment #3
james.williams CreditAttribution: james.williams commentedComment #4
james.williams CreditAttribution: james.williams commentedComment #5
dipakmdhrm CreditAttribution: dipakmdhrm as a volunteer and at QED42 commentedWhile 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.
Comment #6
james.williams CreditAttribution: james.williams commentedDo 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.