The default landing page, it can be customized through the Drupal's templating system.
A good example of language negotiation configuration.
The module configuration page.

Description

This module allows you to present visitors of your website with a landingpage / splash page where they can select the language of their choice, based on the languages that have been enabled on your Drupal site.

This is useful in situations where you don't want to enforce a default language to users (e.g. because of political or corporate sensitivities) if they come to your website without a language preference available (url, cookie, ...)

The language selection page can be overridden through Drupal's template system.

It is recommended that you move the "Selection Page" language detection method near the bottom.
Preferably you need to have another method of detection activated above it, such as "URL" or "Cookie" (via the contrib module Language cookie), if you don't want to have users arrive on the language selection page too frequently.

Features

  • Provides an additional language negotiation fallback using an HTML selection page.
  • It can inject the HTML in the $content of a page or use it's own template that you can customize through the regular theming system.
  • Configure a set of blacklisted paths where the module shouldn't run on.

Tips

  • Try to set a prefix for all the enabled languages to get it working properly
  • You can change the layout of the page by creating a page: html--language-selection.tpl.php in your theme directory, copy the file html.tpl.php from the system module, you can access the new $language_selection_page variable, there's everything you need to customize the page in it.

Using it's API

You can use the hook: hook_language_selection_page_data_alter() to update data sent through the template. Exemple:

<?php
/**
* Implements hook_language_selection_page_data_alter().
**/
function testmodule_language_selection_page_data_alter(&$data) {
  foreach (
$data['links'] as &$item) {
   
$link_text = _scramble_string("Continue in " . $item['language']->native);
   
$item['link'] = l($link_text, $data['from']['text'], array('query' => $data['from']['query'], 'language' => $item['language']));
  }
}
function
_scramble_string($string) {
  return
preg_replace('/(\w+)/e', '_scramble_word("\1")', $string);
}
function
_scramble_word($word) {
  if (
strlen($word) < 2) {
    return
$word;
  } else {
    return
$word{0} . str_shuffle(substr($word, 1, -1)) . $word{strlen($word) - 1};
  }
}
?>

This example will scramble the text displayed in the links in the template.

Related modules

  • Global redirect: Strongly advised, it redirects all URLs without a language prefix to the correct URL with the default language prefix contained.
  • Language cookie

Where is it used ?

Maintainers

Project Information

Downloads