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.
We need to support different language menus. We will provide a separate menu for each enabled language (using the 'fixed language' menu translation mode). The same menu in different languages will be related using translation sets.
- When a new menu is created we will need to clone this menu (including title and description) for each language.
- When a new language is added each existing menu needs to be cloned in this new language.
Deleting languages and menus is not necessary at this point, this will be added in the future when the need arises.
Comments
Comment #1
pfrenssenWhat do we do with existing menus when the module is initially enabled? There could be pre-existing menus that exist in one or more languages. These would need to get mapped to translation sets, and if menus are missing for particular languages it should be possible to generate these.
This is probably not important for the initial alpha version, but ideas on how to handle this are welcome. For the moment we can best ignore any pre-existing menus, and just hook in when new menus are created.
Comment #2
pfrenssenWhen a new menu is created this defaults toI18N_MODE_NONE
. This means that when using the default menu creation UI we can't create different language versions of the menu, since this requiresI18N_MODE_LANGUAGE
.Things went a lot better when I enabled i18_menu.
Comment #3
pfrenssenAdded initial support for translation sets to the branch 1933840. This still needs tests and something to click on.
Comment #4
pfrenssenContinuing work on this.
Comment #5
pfrenssenAlright it finally is done. I went on a long hunting spree to fix some elusive bugs that popped up during testing, boiling down to a missing object declaration in i18n, and an entity cache that needed to be reset after manipulating its contents.
This can most easily be tested by enabling a number of languages, creating a menu, and then running the function
paddle_menu_manager_clone_menus()
, passing in the created menu. The menu should be set to the "Fixed language" translation mode.Or run the test suite, which does this for you with 4 menus in 4 languages :)
There is no front end made in this issue, that will be done in other issues.
Comment #6
Cyberwolf CreditAttribution: Cyberwolf commentedComment #7
Cyberwolf CreditAttribution: Cyberwolf commentedCan we call menu_cache_clear_all() inside paddle_menu_manager_menu_update() so other code calling menu_save() doesn't need to clear the cache itself if they somehow rely on menu translation sets?
Maybe we can also use UUID to generate machine names for clones?
The part specifically developed for this issue looks good otherwise.
Comment #8
Cyberwolf CreditAttribution: Cyberwolf commentedComment #9
pfrenssenThis issue is depending on #1933114: Show the menus of the current language in the management menu.
Comment #10
pfrenssenFixed issues from #7.
Comment #11
pfrenssenSorry I was not tracking the branch on origin, have rebased against the latest version, here are the correct refs:
Comment #12
Cyberwolf CreditAttribution: Cyberwolf commentedLooks good, so RTBC.
We'll probably need to wait 'till #1933114: Show the menus of the current language in the management menu is ready so they can go in together.
Comment #13
Cyberwolf CreditAttribution: Cyberwolf commentedComment #14
iSoLate CreditAttribution: iSoLate commentedMerged in 7.x-1.x. Thanks!