1

I have a problem with custom menu link translations.

Only users with permissions to 'Translate custom menu link' (translate menu_link_content) are able to see the translated strings.

For example if I log in as admin, I can see the link texts changing when switching languages. But when I switch languages as an anonymous user the link texts fall back to the default language. Translated routes are working correctly.

As a workaround I could just give all users the 'translate menu_link_content' -permission but that seems like a possible security flaw.

Is this a bug or am I doing something wrong here?

1 Answer 1

3

Make sure your menu link translations are actually published, there's a checkbox in the edit form. I think there are some bugs there that this isn't set properly when doing it from a node edit form.

2
  • That indeed was the case. The checkbox wasn't displaying at all in node-edit-form. We ended up installing hook_post_action - module and manipulating the link in HOOK_node_postsave(). After having little success with editing the menu link entity, we ended up doing it directly to database. Here's the gist. Thanks for help!
    – Hannu
    Apr 3, 2017 at 6:33
  • You don't need that module, a hook_node_update() should work fine for that as well for your case. But fine as long as it works. You could also check the issue queue and report this as a bug, because I think it is one.
    – Berdir
    Apr 3, 2017 at 12:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.