Create an account

Very important

  • To access the important data of the forums, you must be active in each forum and especially in the leaks and database leaks section, send data and after sending the data and activity, data and important content will be opened and visible for you.
  • You will only see chat messages from people who are at or below your level.
  • More than 500,000 database leaks and millions of account leaks are waiting for you, so access and view with more activity.
  • Many important data are inactive and inaccessible for you, so open them with activity. (This will be done automatically)


Thread Rating:
  • 310 Vote(s) - 3.63 Average
  • 1
  • 2
  • 3
  • 4
  • 5
multiple frontpages in multiple languages

#1
I have a Drupal 7 multi-language(3) website. I have installed the Internationalization (7.x-1.0-beta2) module.

I have created for each language a page, and translate it into two others languages.

Now here is what I want to do: to set a kind of intelligent "front-page" to know what language is selected and set the front page (which I choose) in that language.

How can I do this? I know that in Internationalization module, there is no such kind of thing, am I right? If I set the front page to nothing I get this message: “No front page content has been created yet.” which is normal because Drupal is asking me for one front-page to be set, however I want to have for each language a front-page.
Reply

#2
I haven't worked with Drupal 7 i18n yet, but in Drupal 6 you would add a site_frontpage variable to $conf['i18n_variables'] in settings.php and then switch to each language in turn and set the frontpage on the site information page.

Alternatively, you can specify a condition in your theme front-page.tpl.php [like so][1]


[1]:

[To see links please register here]

Reply

#3
May be there is a better way but finally he is how I did.

I have added in `template.php` the following code:

/**
* Implements hook_preprocess_page().
*/
function aelius_preprocess_page(&$vars) {
if ($vars['is_front']) {
$langcode = $GLOBALS['language']->language;

if ($langcode == "en") {
drupal_goto('home');
} elseif ($langcode == "fr") {
drupal_goto('accueil');
}
}
}

Reply

#4
After continuing to rip my hair out over this, I found out that this feature is **incompatible with anonymous page caching!**

Go to /admin/config/development/performance and turn off page caching for anonymous users.
Reply

#5
I've been searching for the same. I 'd like to recommend [Drupal 7 - multi-lingual front page node][1] which is complete and works perfectly for Drupal 7 projects.


[1]:

[To see links please register here]

Reply

#6
Might be late to the party with this answer, but after many hours spent trying to solve this myself, I've the following solution.

For Drupal 7:

1- Make sure you have the modules Variable and Variable Translations switched on.<br>
2- Goto admin/config/regional/i18n/variable<br>
3- Select the 'Site information' list tab and check 'Default front page', save settings.<br>
4- Goto admin/config/system/site-information, you'll notice a block of text there saying something about some of your settings being multilingual variables and a list of links for the languages you are running which allow you to set the settings for each language.

Now, this is where the real GOTCHA comes up... clicking those links and changing the settings does nothing. Your left with the same settings still for all languages. The way around this?

Check the URL you are currently on, the entire thing, so something like:

[To see links please register here]


Notice the language prefix there before /admin?? To change the settings for the other languages you want to use, switch the prefix in the URL and then make your changes. And now, as if by magic, multiple front pages, properly changing based on language.

This must be a bug in Drupal, I should get around to opening a ticket. But for now, if someone else comes across this, I hope it solves your problem too.
Reply



Forum Jump:


Users browsing this thread:
1 Guest(s)

©0Day  2016 - 2023 | All Rights Reserved.  Made with    for the community. Connected through