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.
Hi,
Unfortunately the menu breadcrumb only works on the default language.
Only the "home" link gets translated, the other links not, although the links do point to the correct language version of a node.
For example:
Default language spanish:
Inicio > Contacto (link points to es/contacto) > Dirección
Home > Contacto (link points to en/contact) > Dirección
How can I solve this problem?
Comment | File | Size | Author |
---|---|---|---|
#4 | menu-breadcrumb-translation-2821734-4.patch | 1.88 KB | hitfactory |
Comments
Comment #2
rphair CreditAttribution: rphair at COSD commentedThe menu links from which those titles are taken are all translatable entities. The Menu Breadcrumb module only extracts those titles, which will already have been translated as necessary by the translation modules in Drupal Core.
There isn't a Translation Drupal doc page I know of yet that goes into detail about translating the menu items. There is a current procedure in this comment: How to translate Menu and Menu Items. I would start with the part where it says "enable Custom Menu Link" after which "new form fields (are) visible on the page".
I would like to set up some test cases for this module to demonstrate it working in multilingual environments. If you would please follow the instructions in the comment above and post here your results, that will help me prioritise this.
Comment #3
bolecha CreditAttribution: bolecha commentedThank you for your answer and help.
I followed the instructions in the comment above.
The menu itself is working fine: the menu items are displayed properly as per the language selected in language switcher.
Unfortunately, the links in the breadcrumb are not translated (except for the home title), although they do point to the correct language version of a node......
Comment #4
hitfactory CreditAttribution: hitfactory commentedAttached is a patch I am using against 1.0-beta2.
It uses the same approach suggested in the Token module issue queue https://www.drupal.org/node/2787977 which is to load the MenuLinkContent entity and then fetch the translated title.
Patch needs to be refactored to use language_manager service and logic added to skip the new bits if the site is not multilingual, but might be useful to someone in the meantime.
Comment #5
bolecha CreditAttribution: bolecha commentedThank you very much, hitfactory!
Your patch is working fine!
Comment #6
rphair CreditAttribution: rphair at COSD commentedyes @hitfactory - that's great, thanks for the patch, it was hard for me to find the right approach for this one. Just need to find the right way of integrating this to suit the non-multilingual sites & will include this in the dev version & a new beta.
Comment #8
rphair CreditAttribution: rphair at COSD commentedRevisions to code includes patch #4 plus conditional for multilingual sites, injected services & cache context for content language. Rolled into beta3 version. Thanks also to @bolecha for pressing this point.
Comment #9
rphair CreditAttribution: rphair at COSD commented