clement
clement

Reputation: 4266

menu drupal in multilingual site

I can't see any menu in the EN version of my drupal site with the following settings in my menu :

setting setting

When I select french all is ok but when I select english, nothing appears (I have content in both menu indeed)

html zone for the menu

In the blocks section, I see the two menus disabled.

Thanks to help me :-)

Upvotes: 2

Views: 4715

Answers (4)

Muhammad Reda
Muhammad Reda

Reputation: 27023

I would suggest using menu block contrib module.

This module will allow you to treat your menus as blocks.

Create 2 blocks (1 for each menu), and in block administration page you can specify the language for each block.

Upvotes: 3

John Peter
John Peter

Reputation: 2928

There is a Seven Steps to achieve :

Step 1: Enable all modules

  • Content Translation (core module)
  • Locale (core module)
  • Internationalization
  • Variable

optional:

  • Language Icons
  • Translation Overview

Step 2: Add a language

Go to Configuration > Regional and Language > Languages

The default language is English, and you can use the “Add Language” link to add either Predefined or custom languages.

Step 3: Detection and Selection

For this tutorial I’ve chosen to use the “URL Prefix” setting. This tells Drupal to use domain.com/es for Spanish and domain.com/de for German.

Step 4: Enable Multilingual Support for content types

Either create or edit an existing Content Type and click “Publishing Options”. Here you will see the option for enabling multilingual support. Select “Enabled, with translation. This will allow you to translate a node into multiple languages.

Step 5: Create English Content

When you create your nodes, make sure you are using the correct language, not just “Language neutral”. This is important because when you create the URL alias and Menu link title it will know which menu to put the link in.

Once you’ve created your node you should see a “translate” tab. If you click this tab you’ll be able to add a translation to this node.

Note that if you have the “Translation Overview” module installed (I highly suggest it) you’ll get a nice little window that tells you which languages you’ve added, which require priority, etc.

Step 6: Created the translated content

When you create your translation give it a translated menu link title, but give it the same url alias as the original node. Because you have multilingual support installed, it won’t give you any errors for having the same URL alias (remember, it’s putting the Spanish nodes at domain.com/es and the German nodes at domain.com/de).

Step 7: Add support for multilingual menus

Go to Structure > Menus > Main Menu. Edit the menu and enable the “Translate and Localize” option. This will switch your menu items depending on what language the user has selected site-wide.

You’ll see you have both the English menu items and the Spanish items. You can order these like you wish, but know that only the Spanish links will show up when Spanish is selected as the main menu (you’ll know because the URL will say domain.com/es).

And your final product: In front end you can see it action .

Also you can use i18n_menu_navigation_links function.

Upvotes: 0

gkom
gkom

Reputation: 43

I find that having two menus is always easier for multilingual websites. I also prefer to use different views pages for different languages so I don't run into problems. That way I can add the path to the corresponding menu easily. Whenever I have tried to combine multilingual views and menus I have faced numerous problems.

In the screenshot you included I can see you have two menus.

First of all, I find it easier to name and title the menus according to their language because it's easy to get confused otherwise i.e. Main Menu English - main_menu_en.

Secondly, your french menu probably works because it's printed by your theme which is configured to render the main menu links in the specific region. To get your English menu to work you'll have to either:

a) add the required code in your theme, or

b) remove the code for the main menu in your theme and use 2 menu blocks placed in the desired region via the block admin page. In the block settings for each block you can select which language they'll be displayed for.

As the others said, you'll need: menu_block

If you need help with adding or removing the menu from your theme, please tell us which theme you are using.

Upvotes: 1

s.Daniel
s.Daniel

Reputation: 1064

As there are usually several ways to reach a goal with drupal here is a proposal for a work around:

  • Create two menus with no language settings.
  • Try to put all menu items as neutral language so they show up in both languages. (test that)
  • Assign the menus as blocks to the right region.
  • Then use the i18n module to control the language specific display at the block level instead of the menu or menu item level. (Note you need the i18n_block module to do that which is part of the i18n module)
  • If you need aditional settings for the blocks see the allready mentioned menu block module.
  • Also make sure you check the internationalisation documentation.

Upvotes: 1

Related Questions