Hi There,
Currently I am injecting our English links into the menu with machine name "main". This is working well.
We are building a multilingual site -- English, Spanish and Chinese. The design recommendation from Gábor Hojtsy is to create one menu and block for each language as you can see here:
http://www.drupal8multilingual.org/hacks/drupal-8-multilingual-hack-1-bu...
I need to create three different menus -- one for each language. The block associated with the menu will be restricted so it will only show when a page of the associated language is requested. for example, when a Spanish page is shown, the Spanish Nav Menu will be shown as well.
How can I setup these menus so that Bootstrap will recognize each of them as a Nav menu?
Thanks!
Comments
Comment #2
markhalliwellJust assign the block(s) to the navigation (or navigation_collapsible) region. Anything past that really falls outside the scope of this project.
Comment #3
Greg Sims CreditAttribution: Greg Sims commentedI did not write this issue very well initially -- sorry.
The default main menu is unique because of: menu--main.html.twig. It appears in order to have the same features on three navbars we need to copy menu--main.html.twig three times, one for each of the language primary menus ids. It would be great to have one .twig that covers a set of menu ids (for example: main-en, main-es, main-zh). This would allow for one set of twig code that applies to this set of menus. Do you know if this is possible? Perhaps another approach would be better.
I appreciate your help! Greg
Comment #4
markhalliwellThere's two possible solutions:
menu--main-en.html.twig
,menu--main-es.html.twig
andmenu--main-zh.html.twig
frommenu--main.html.twig
.hook_theme_suggestions_alter()
.Comment #5
kaido.toomingas CreditAttribution: kaido.toomingas as a volunteer and commentedI had the same situation. What I did was.
Created all the different menus. Created files as Mark suggested and added only.
{% include 'menu--main.html.twig' %}