Setting up a multilingual home page in D7

In my previous article, I've introduced a basic setup that will help you create a functional bilingual menu system. There are probably other ways of going it. But, so far, this method works for me.

If you follow and repeat the steps outlined in Setting up multilingual menus in D7, you should be able to create primary menus for an About us or a Services page with, say, the Page content type.

With the MAIN ENGLISH and MAIN FRENCH menus in place, all you need to do is create a new page and, in the Menu settings tab, check the Provide a menu link option, enter About us or Services for the Menu link title and make sure you set the Parent item to the appropriate menu. In this case, About us belongs to the ENGLISH MAIN MENU.

Next, you would add a translation for About us - say À propos - and, this time around, create a menu link whose Parent item is, of course, MAIN FRENCH MENU.

Repeat as required for all other primary menus.

There is one exception and it's the Home page. If you create a Welcome! page with the Page content type and want it to be your new home page instead of Drupal's default node, it just won't work properly unless you do it this way:

  1. After you've created the Welcome! page and provided a menu link named Home with Parent item MAIN ENGLISH MENU, set the URL Path Settings to home while leaving Automatic alias unchecked. The full URL to your new home page would then be something like this: example.com/home. I'm assuming the Pathauto module is installed & enabled.
  2. Add a translation for the Welcome! page. In French it would be Bienvenue! Provide a menu link named Accueil (French for Home) with Parent item MAIN FRENCH MENU, set the URL Path Settings to exactly the same value as for the Welcome! page: home, Automatic alias unchecked. This is the not so obvious part that is easy to miss. If you had a third language, say Spanish, the menu title for the Spanish home page could be Inicio, the URL Path settings, again, unchanged: home, Automatic alias unchecked.
  3. Finally, you need to tell Drupal that you want these pages to be the home pages for the enabled languages on your website. You can do this by going to en/admin/settings/site-information and setting the Default front page field to home.

So the trick is, home pages for all languages share a common alias which will be hidden and replaced by the appropriate path prefix (e.g. /en, /fr, /es). I admit, it took me a while to figure that one out. In fact, it use to drive me crazy.

It's good to be home, isn't it ?!

Add new comment

Plain text

  • Lines and paragraphs break automatically.
  • Allowed HTML tags: <em> <strong> <cite> <blockquote> <code> <ul> <ol> <li> <dl> <dt> <dd>
By submitting this form, you accept the Mollom privacy policy.