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.
By marc.teyssier on
Hi,
I try to develop my website with the new Drupal 8 in multilingual.
I succeed to translate the content (I have a "Translate" tab) without difficulty.
But I don't understand how can I translate the menu ?
- In configuration -> Content language and translation -> I have check :
- in "custom language settings": menu link
- Show language selector on create and edit pages for all the menu (I don't have the check box "translatable" like the content)
- In expand: I have check all the element link to the tranlsation
- In the menu (structure -> menus -> Main navigation for example), I try to activate in MENU LINKS LANGUAGE the check box Enable translation and it isn't checked after validation
- In the menu (structure -> menus -> Main navigation for example), I try to use the tab "Translate menu" and I have an error: Fatal error: Call to a member function getBodyAttributes() on a non-object in core\themes\seven\seven.theme on line 39
Can you help me to translate my menu website?
What did I forget?
Thank you
Marc
Comments
In the same boat my friend!
Hi.
Yeah... still buggy...
NR
Same issue
I experienced the same issue
http://www.webstanz.be
How to translate Menu and Menu Items.
Firstly you need to enable all the translation modules Under "Multilingual" Heading.
- 1. Language
- 2. Content Translation
- 3. Configuration Translation
- 4. Interface Translation
Now navigate to Configuration >> Regional and language >> Content language and translation.
Under heading "Custom language settings"
enable "Content" and "Custom menu link".
Now new form fields will be visible in page.
Now enable the content translation for the content type where you want translation and fields as needed.
In "Custom menu link" configuration check all check boxes.
Save the configuration.
Enable the translation in the content type edit form. Under "Language settings" check the "Enable translation" "show language selector on create and edit page" options, and save the content type form.
Now Add the content translation for translation enabled content type above.
Go to "Structure >> Menus" page. You will see the list of the menus.
there is drop down button in front of each menu. Select the "Translate" option.
In "Translate Menu" tab, Click the "Add" button in front of the second language.
Add "Label" translation here, and "Save translation".
At this stage we have enabled content translation, Menu translation, Added translated content. Now we have to add the menu item translation. this is little tricky.
Go to "Structure >> Menu".
Click the "Edit Menu" in front of the menu name.
List of the menu links will be displayed on the page.
Click the "Translate" option in front of the menu item you want to translate.
List of enabled language is displayed here. click the "Add" button in front of the language.
Add "Menu link title" for translation.
In "Link" autocomplete field add the title of the translation for node.
Click "Save" button.
Repeat the process for all the menu items. And you are Done.
Check the menu items are displayed properly as per the language selected in language switcher.
I hope this will help to someone. Good Luck. :)
If I want to translate link
If I want to translate link field in menu item translation then how to achieve that? I didn't find any way for translating link field as the title field is translatable by default.
Translate path or any field.
Hi,
To translate any field related to the content, navigate to path '/admin/config/regional/content-language' on your site.
Check the checkbox in front of the field.
For translation of the menu item on menu item list page, for every menu link there is translate option below edit button. Using this you can translate the link text.
won't work. the link of a
won't work. the link of a menu is for all languages. if you change one link, you change all links for this menu item translations. in the database it shows. i know a bypass for internal links, but not external. is there one?
I add it to Multiligual guide.
Hi, I feel this is a very good first tutorial, so I add it to Multiligual guide. https://www.drupal.org/docs/8/multilingual/menu-translation-in-drupal-8
I hope someone aprove it and may be you can help with the edition.
Web designer from mexico.
translate link menu
thanks , I have same problem
Translating the link doesnt work
I also run into the same issue as @neelam.chaudhary I am unable to translate a link using absolute link either any help would be much appreciated
Translate link... same problem
Please can you tell us how to translate the link of a menu (the path)... I can't imagine that it's not possible to do that
ex: "/boat" for english - "/bateau" for french
still buggy...
Please can you tell us how to translate the link of a menu (the path)...
I can't imagine that it's not possible to do that in (D8) !!!!!
ex: "/contact" for english - "/اتصل" for Arabic
Alternate Solution
I did it with custom code as I added one field on menu add/edit form and then saved this field value in options of the menu item and with hook_link_alter() alter link of the menu link item with this new field's value. Keep one thing if this alternate field's value is present then only replace the link value otherwise keep the default functionality.
This is only an alternate solution for this problem.
Hi,
Hi,
To translate custom block/menu content try the follwing:
Install and enable your desired languages in Admin > Config > Regional and Language > Languages
Enable the content translation module
Go to Admin > Config > Regional and language > Content language and translation
Select under Custom language settings the option 'Custom block'
Select all options in the newly added page section 'Custom block'
Go to Structure > Block lay-out > Custom block library
Select in the column 'operations' the option 'translate'
You should get a page 'Translations of [block-name]' with the currently enabled languages
Click add in the column 'operations' to create a translation of the block
It might help you.
so all this discussion to say
so all this discussion to say that Drupal 8 menus can't provide a different LINK ??
major fail.
Just to second Manarak. Major
Just to second Manarak. Major, major fail.
I've had this discussion before. Drupal follows a "content translation" pattern. Text A gets translated to Text A in a different natural language.
However, Drupal does not (generally) provide a Localisation pattern, whereby one Drupal language translation as Text A, but another Drupal Language translation has Text A translated and a Text B.
This also goes to Drupal menus, where all you can translate is the Menu Label. You cannot have a Drupal language translation with a different link or even have the menu item disabled or deleted.
Its been pointed out to me that this is not a defect, it is 'by design'.
Yes, well maybe, but its bad design.