Node listing as the homepage

When creating a multilingual Drupal site, if your site front page is a node listing (which is the default in Drupal), you can enable the Multilingual select module, included in the contributed Internationalization (i18n) package of modules, and the content for each language will be selected depending on your settings for 'Language selection' (Administration > Configuration > Regional and language > Multilingual settings > Selection ) so you won't need to do anything else in this case.

Different node or path per language as the homepage

When using a single node as the front page, or when using a different path per language for the front page, the page won't switch automatically depending on the language detection. You need to use the Variable translation module (part of the Internationalization package) to specify a default front page path per language.

  • In Configuration > Regional and languages: Multilingual settings > Variables, enable 'Default front page' as a multilingual variable.
  • Go to Configuration > System > Site information > Front page.
  • Change the language via the section "Select language" at the top of the page to select the language for which you're setting the front page option.
  • Set the 'Default front page' option for the current language.
  • Repeat as necessary for each available language.

If using language prefixes, do not include the language prefix in your path.

Note that, so far, the "Front page" contributed module (version 7.x-2.0-rc1) doesn't support internationalization.

Due to an error in Drupal core, using a different home page per language may lead to problems for anonymous users, see #339958: Cached pages returned in wrong language when browser language used for the details. To alleviate problems like this, a small (sandbox) module was written to execute a real redirect from the home page to the page that is defined as serving the front page: Front page redirect.

Comments

Elvin - Albania Drupal Developer’s picture

This article saved me 3 hours of hair pulling. You need to specify how to set up 2 different nodes as the homepage of a site on the I18N module page so that it is easy for people to get started building multilingual sites.

chiappa’s picture

I will start off by saying that a lot of the documentary for this module is really nice and I am very thankful for that. But as elvin suggested this is something very important and for me the very first thing I want to set up is a multilingual front page! My suggestion is that this should be included in the: "HowTo: Basic Internationalization setup" page.

Furthermore after going trough these steps the language variable would still not change. What saved my hair was a page titled: "DRUPAL 7: CRACKING THE MULTILINGUAL FRONT PAGE NUT." Go and have a look: Multilingual front page in Drupal

carolalind’s picture

Thank you so much chiappa!!!

"DRUPAL 7: CRACKING THE MULTILINGUAL FRONT PAGE NUT." Go and have a look: Multilingutal front page in Drupal
This worked right away. I have been fighting this nut forever!!!

anou’s picture

here the right link today: Multilingual front page in Drupal

David THOMAS
http://www.smol.org

The Hawk’s picture

I have changed the default front page via dashboard -> Configuration -> System -> Site information
and now i can no longer access the login page.
At first, the default front page field contained mysite/node. This works fine and is what i need, but i changed it to mysite/user/login. The reason for this change was because no matter if a person is logged in or out www.mysite.com does not redirect them to the login page. So, being new to drupal, I decided if I set the default front page to mysite/user/login then they would be forced to see the login page.
The problem I am now facing is that i cannot log in to the site to make any changes.

I have tried several different url paths such as:
mysite/user
mysite/user/login
I have also tried the unclean url versions. If i try mysite/admin I get an access denied message.

So my question is, where is the change i made stored in drupal 7's database? I would like to just edit the field that stores this change back to what it was to "unbreak" the site.

TheoAbiel’s picture

A very good article! I was searching for this a long time...

xlith’s picture

Hi, i am a noob developer from Turkey and learning Drupal 8. I search everywhere but couldn't find. I am tring to keep track of language choise of anonimous users and store this choise in the cookie but i stucked on drupal cache. Next time when user comes to my site again i want to redirct user to appropriate url. Could you direct me to correct documantation or help me?