Skip to main content
Drupal is a registered trademark of Dries Buytaert
Release: Views Bootstrap 5.5.4 — Minor update available for module views_bootstrap (5.5.4). Release: Rightup theme 1.0.3 — Minor update available for theme vartheme_bs5_rightup (1.0.3). Release: CommentOn 1.0.6 — Minor update available for module commenton (1.0.6). Release: ChatGPT Ads 1.0.3 — Minor update available for module chatgpt_ads (1.0.3). Release: Opensolr Search 5.1.3 — Minor update available for module opensolr_search (5.1.3). Release: ServiceM8 Webform Integration 1.2.1 — Minor update available for module servicem8_webform (1.2.1). Release: PostfixAdmin 1.0.0 — Initial release available for module postfix_admin (1.0.0)! Release: ip_analyser 1.0.3 — Minor update available for module ip_analyser (1.0.3). Module Revived: Swagger-PHP OpenAPI 3 documentation generator 1.0.0 — Module swagger_php updated after 10 months of inactivity (1.0.0). Security Coverage: Microsoft Azure AI — Module ai_provider_azure now has official Drupal security advisory coverage.

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:

/**
 * 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

  • Pol - Drupal 6, Drupal 7 and Drupal 8 version
  • svendecabooter - Drupal 7 version improvements

Depends on

Dependencies of the latest stable release

No dependencies recorded for this project.

Required by

Tracked projects that depend on this one

No tracked projects depend on this one yet.

Activity

Tracked releases
4
Tracked since
Mar 2023
Latest release
2 years ago
Releases (12 mo)
0
Maintenance
Dormant

Release Timeline

Releases

Version Type Core Release date
3.0.x-dev Dev Aug 13, 2024
3.0.0 Stable Aug 13, 2024
8.x-2.12 Stable Jan 22, 2024
8.x-2.11 Stable Mar 3, 2023