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?

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

bolecha created an issue. See original summary.

rphair’s picture

Category: Bug report » Support request
Status: Active » Postponed (maintainer needs more info)

The 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.

bolecha’s picture

Thank 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......

hitfactory’s picture

Attached 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.

bolecha’s picture

Thank you very much, hitfactory!

Your patch is working fine!

rphair’s picture

yes @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.

  • rphair committed cf09d65 on 8.x-1.x
    Issue #2821734 by hitfactory, rphair: Menu breadcrumb is not working in...
rphair’s picture

Revisions 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.

rphair’s picture

Assigned: Unassigned » rphair
Category: Support request » Feature request
Status: Postponed (maintainer needs more info) » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.