Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Problem/Motivation
It is currently not possible to translate a node and assign different translations of that node to different menus, such as when you have a "Main menu (English)" menu and a "Main menu (French)" menu that are not translations of each other, with different structures.
Proposed resolution
Make the fields translatable.
Remaining tasks
Decide on an approach
Patch
Tests
Review
User interface changes
Fields are available for translation now ("menu name" and "parent plugin ID" should probably be combined into "parent" in the UI):
API changes
Data model changes
weight, parent, menu_name fields become translatable on menu link content
Comment | File | Size | Author |
---|---|---|---|
#10 | 2858201-10.patch | 6.75 KB | stefan.r |
#7 | 2858201-7.patch | 6.76 KB | stefan.r |
#6 | 2858201-6.patch | 7.03 KB | stefan.r |
#5 | 2858201-5.patch | 1.7 KB | jofitz |
#2 | 2858201-1.patch | 1.7 KB | stefan.r |
Comments
Comment #2
stefan.r CreditAttribution: stefan.r commentedI wonder if we should also make some of the other fields translatable (link, external, enabled, ..)
Comment #3
timmillwoodLooks good, glad it worked.
I wonder if there's a reason not to make everything translatable.
Comment #5
jofitz CreditAttribution: jofitz at ComputerMinds commentedRe-rolled.
Comment #6
stefan.r CreditAttribution: stefan.r commentedAdding some tests and an update hook
Comment #7
stefan.r CreditAttribution: stefan.r commentedComment #10
stefan.r CreditAttribution: stefan.r commentedThis doesn't update menu_tree correctly yet, only data from whichever translation was last saved is stored currently
Comment #11
dawehnerIs it just me that this test coverage is a bit weak? Can't we ensure that the link is actually available in the two separate selected menus?
Comment #12
stefan.r CreditAttribution: stefan.r commentedDiscussing this on IRC with @pwolanin, this patch is probably not the right approach.
He's suggesting a menu link field (#2315773: Create a menu link field type/widget/formatter) and patching the node menu widget to allow for a separate menu link per translation (rather than translating menu links themselves).
Comment #13
pwolanin CreditAttribution: pwolanin as a volunteer and commentedYes, we should close this issue I think
Comment #14
stefan.r CreditAttribution: stefan.r commentedWe're working on a solution in #2859270: Cleanup the entity <-> menu link integration